bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
6614.1.3
by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual. |
1 |
# Copyright (C) 2005-2013, 2016 Canonical Ltd
|
|
1685.1.80
by Wouter van Heyst
more code cleanup |
2 |
#
|
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
3 |
# This program is free software; you can redistribute it and/or modify
|
4 |
# it under the terms of the GNU General Public License as published by
|
|
5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
6 |
# (at your option) any later version.
|
|
|
1685.1.80
by Wouter van Heyst
more code cleanup |
7 |
#
|
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
8 |
# This program is distributed in the hope that it will be useful,
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
# GNU General Public License for more details.
|
|
|
1685.1.80
by Wouter van Heyst
more code cleanup |
12 |
#
|
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
13 |
# You should have received a copy of the GNU General Public License
|
14 |
# along with this program; if not, write to the Free Software
|
|
|
4183.7.1
by Sabin Iacob
update FSF mailing address |
15 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
16 |
|
17 |
import os |
|
18 |
||
|
6624
by Jelmer Vernooij
Merge Python3 porting work ('py3 pokes') |
19 |
from .. import ( |
|
5097.1.12
by Vincent Ladeuil
Implement the --exclude-common-ancestry log option. |
20 |
branchbuilder, |
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
21 |
errors, |
22 |
log, |
|
23 |
registry, |
|
24 |
revision, |
|
25 |
revisionspec, |
|
26 |
tests, |
|
|
6583.4.5
by Reagan Sanders
Added a test case covering the possibility of UTF-8 characters within the name portion of a GPG key. This can happen during a 'bzr log --signatures' command. |
27 |
gpg, |
28 |
trace, |
|
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
29 |
)
|
|
6624
by Jelmer Vernooij
Merge Python3 porting work ('py3 pokes') |
30 |
from ..sixish import ( |
|
6621.22.2
by Martin
Use BytesIO or StringIO from bzrlib.sixish |
31 |
BytesIO, |
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
32 |
StringIO, |
|
7029.4.8
by Jelmer Vernooij
Merge trunk. |
33 |
unichr, |
|
6621.22.2
by Martin
Use BytesIO or StringIO from bzrlib.sixish |
34 |
)
|
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
35 |
|
36 |
||
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
37 |
class TestLogMixin(object): |
38 |
||
39 |
def wt_commit(self, wt, message, **kwargs): |
|
40 |
"""Use some mostly fixed values for commits to simplify tests. |
|
41 |
||
42 |
Tests can use this function to get some commit attributes. The time
|
|
43 |
stamp is incremented at each commit.
|
|
44 |
"""
|
|
45 |
if getattr(self, 'timestamp', None) is None: |
|
46 |
self.timestamp = 1132617600 # Mon 2005-11-22 00:00:00 +0000 |
|
47 |
else: |
|
48 |
self.timestamp += 1 # 1 second between each commit |
|
49 |
kwargs.setdefault('timestamp', self.timestamp) |
|
50 |
kwargs.setdefault('timezone', 0) # UTC |
|
51 |
kwargs.setdefault('committer', 'Joe Foo <joe@foo.com>') |
|
52 |
||
53 |
return wt.commit(message, **kwargs) |
|
54 |
||
55 |
||
56 |
class TestCaseForLogFormatter(tests.TestCaseWithTransport, TestLogMixin): |
|
|
3144.7.9
by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors |
57 |
|
58 |
def setUp(self): |
|
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
59 |
super(TestCaseForLogFormatter, self).setUp() |
|
3144.7.9
by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors |
60 |
# keep a reference to the "current" custom prop. handler registry
|
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
61 |
self.properties_handler_registry = log.properties_handler_registry |
|
4325.4.3
by Vincent Ladeuil
More cleanups. |
62 |
# Use a clean registry for log
|
|
3144.7.9
by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors |
63 |
log.properties_handler_registry = registry.Registry() |
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
64 |
|
|
4325.4.3
by Vincent Ladeuil
More cleanups. |
65 |
def restore(): |
66 |
log.properties_handler_registry = self.properties_handler_registry |
|
67 |
self.addCleanup(restore) |
|
|
3144.7.9
by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors |
68 |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
69 |
def assertFormatterResult(self, result, branch, formatter_class, |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
70 |
formatter_kwargs=None, show_log_kwargs=None): |
|
4857.4.5
by John Arbash Meinel
We don't need the utf8 option, no test actually wanted to run without it, |
71 |
logfile = self.make_utf8_encoded_stringio() |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
72 |
if formatter_kwargs is None: |
73 |
formatter_kwargs = {} |
|
74 |
formatter = formatter_class(to_file=logfile, **formatter_kwargs) |
|
75 |
if show_log_kwargs is None: |
|
76 |
show_log_kwargs = {} |
|
77 |
log.show_log(branch, formatter, **show_log_kwargs) |
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
78 |
self.assertEqualDiff(result, logfile.getvalue()) |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
79 |
|
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
80 |
def make_standard_commit(self, branch_nick, **kwargs): |
81 |
wt = self.make_branch_and_tree('.') |
|
82 |
wt.lock_write() |
|
83 |
self.addCleanup(wt.unlock) |
|
84 |
self.build_tree(['a']) |
|
85 |
wt.add(['a']) |
|
86 |
wt.branch.nick = branch_nick |
|
87 |
kwargs.setdefault('committer', 'Lorem Ipsum <test@example.com>') |
|
88 |
kwargs.setdefault('authors', ['John Doe <jdoe@example.com>']) |
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
89 |
self.wt_commit(wt, 'add a', **kwargs) |
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
90 |
return wt |
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
91 |
|
|
4955.4.1
by Vincent Ladeuil
Refactor the function into an helper. |
92 |
def make_commits_with_trailing_newlines(self, wt): |
93 |
"""Helper method for LogFormatter tests""" |
|
94 |
b = wt.branch |
|
95 |
b.nick = 'test' |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
96 |
self.build_tree_contents([('a', b'hello moto\n')]) |
97 |
self.wt_commit(wt, 'simple log message', rev_id=b'a1') |
|
98 |
self.build_tree_contents([('b', b'goodbye\n')]) |
|
|
4955.4.1
by Vincent Ladeuil
Refactor the function into an helper. |
99 |
wt.add('b') |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
100 |
self.wt_commit(wt, 'multiline\nlog\nmessage\n', rev_id=b'a2') |
|
4955.4.1
by Vincent Ladeuil
Refactor the function into an helper. |
101 |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
102 |
self.build_tree_contents([('c', b'just another manic monday\n')]) |
|
4955.4.1
by Vincent Ladeuil
Refactor the function into an helper. |
103 |
wt.add('c') |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
104 |
self.wt_commit(wt, 'single line with trailing newline\n', rev_id=b'a3') |
|
4955.4.1
by Vincent Ladeuil
Refactor the function into an helper. |
105 |
return b |
106 |
||
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
107 |
def _prepare_tree_with_merges(self, with_tags=False): |
108 |
wt = self.make_branch_and_memory_tree('.') |
|
109 |
wt.lock_write() |
|
110 |
self.addCleanup(wt.unlock) |
|
111 |
wt.add('') |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
112 |
self.wt_commit(wt, 'rev-1', rev_id=b'rev-1') |
113 |
self.wt_commit(wt, 'rev-merged', rev_id=b'rev-2a') |
|
|
6973.10.6
by Jelmer Vernooij
Fix tests. |
114 |
wt.set_parent_ids([b'rev-1', b'rev-2a']) |
115 |
wt.branch.set_last_revision_info(1, b'rev-1') |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
116 |
self.wt_commit(wt, 'rev-2', rev_id=b'rev-2b') |
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
117 |
if with_tags: |
118 |
branch = wt.branch |
|
|
6973.10.6
by Jelmer Vernooij
Fix tests. |
119 |
branch.tags.set_tag('v0.2', b'rev-2b') |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
120 |
self.wt_commit(wt, 'rev-3', rev_id=b'rev-3') |
|
6973.10.6
by Jelmer Vernooij
Fix tests. |
121 |
branch.tags.set_tag('v1.0rc1', b'rev-3') |
122 |
branch.tags.set_tag('v1.0', b'rev-3') |
|
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
123 |
return wt |
124 |
||
|
5691.1.2
by Jelmer Vernooij
Add tests for ghosts in mainline during log. |
125 |
|
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
126 |
class LogCatcher(log.LogFormatter): |
|
4325.4.3
by Vincent Ladeuil
More cleanups. |
127 |
"""Pull log messages into a list rather than displaying them. |
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
128 |
|
|
4325.4.3
by Vincent Ladeuil
More cleanups. |
129 |
To simplify testing we save logged revisions here rather than actually
|
|
4325.4.1
by Vincent Ladeuil
Some cleanups. |
130 |
formatting anything, so that we can precisely check the result without
|
|
4325.4.3
by Vincent Ladeuil
More cleanups. |
131 |
being dependent on the formatting.
|
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
132 |
"""
|
|
2466.8.1
by Kent Gibson
Reworked LogFormatter API to simplify extending the attributes of the revision being logged. Added support for begin_log() and end_log() hooks in LogFormatters. |
133 |
|
|
4955.4.5
by Vincent Ladeuil
Start reproducing the problems reported in the bug. |
134 |
supports_merge_revisions = True |
|
2490.1.2
by John Arbash Meinel
Cleanup according to PEP8 and some other small whitespace fixes |
135 |
supports_delta = True |
|
4955.4.11
by Vincent Ladeuil
Give some tests a better focus and simplify them accordingly. |
136 |
supports_diff = True |
|
4955.4.5
by Vincent Ladeuil
Start reproducing the problems reported in the bug. |
137 |
preferred_levels = 0 |
|
2466.8.1
by Kent Gibson
Reworked LogFormatter API to simplify extending the attributes of the revision being logged. Added support for begin_log() and end_log() hooks in LogFormatters. |
138 |
|
|
4955.4.5
by Vincent Ladeuil
Start reproducing the problems reported in the bug. |
139 |
def __init__(self, *args, **kwargs): |
140 |
kwargs.update(dict(to_file=None)) |
|
141 |
super(LogCatcher, self).__init__(*args, **kwargs) |
|
|
4325.4.4
by Vincent Ladeuil
Clarify LogCatcher purpose. |
142 |
self.revisions = [] |
|
1704.2.20
by Martin Pool
log --line shows revision numbers (Alexander) |
143 |
|
|
2466.8.1
by Kent Gibson
Reworked LogFormatter API to simplify extending the attributes of the revision being logged. Added support for begin_log() and end_log() hooks in LogFormatters. |
144 |
def log_revision(self, revision): |
|
4325.4.4
by Vincent Ladeuil
Clarify LogCatcher purpose. |
145 |
self.revisions.append(revision) |
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
146 |
|
147 |
||
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
148 |
class TestShowLog(tests.TestCaseWithTransport): |
|
1102
by Martin Pool
- merge test refactoring from robertc |
149 |
|
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
150 |
def checkDelta(self, delta, **kw): |
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
151 |
"""Check the filenames touched by a delta are as expected. |
152 |
||
153 |
Caller only have to pass in the list of files for each part, all
|
|
154 |
unspecified parts are considered empty (and checked as such).
|
|
155 |
"""
|
|
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
156 |
for n in 'added', 'removed', 'renamed', 'modified', 'unchanged': |
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
157 |
# By default we expect an empty list
|
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
158 |
expected = kw.get(n, []) |
159 |
# strip out only the path components
|
|
160 |
got = [x[0] for x in getattr(delta, n)] |
|
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
161 |
self.assertEqual(expected, got) |
162 |
||
163 |
def assertInvalidRevisonNumber(self, br, start, end): |
|
164 |
lf = LogCatcher() |
|
165 |
self.assertRaises(errors.InvalidRevisionNumber, |
|
166 |
log.show_log, br, lf, |
|
167 |
start_revision=start, end_revision=end) |
|
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
168 |
|
|
974.1.54
by aaron.bentley at utoronto
Fixed the revno bug in log |
169 |
def test_cur_revno(self): |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
170 |
wt = self.make_branch_and_tree('.') |
171 |
b = wt.branch |
|
|
1092.3.4
by Robert Collins
update symlink branch to integration |
172 |
|
173 |
lf = LogCatcher() |
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
174 |
wt.commit('empty commit') |
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
175 |
log.show_log(b, lf, verbose=True, start_revision=1, end_revision=1) |
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
176 |
|
177 |
# Since there is a single revision in the branch all the combinations
|
|
178 |
# below should fail.
|
|
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
179 |
self.assertInvalidRevisonNumber(b, 2, 1) |
180 |
self.assertInvalidRevisonNumber(b, 1, 2) |
|
181 |
self.assertInvalidRevisonNumber(b, 0, 2) |
|
182 |
self.assertInvalidRevisonNumber(b, -1, 1) |
|
183 |
self.assertInvalidRevisonNumber(b, 1, -1) |
|
|
6965.1.3
by Jelmer Vernooij
Fix test. |
184 |
self.assertInvalidRevisonNumber(b, 1, 0) |
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
185 |
|
186 |
def test_empty_branch(self): |
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
187 |
wt = self.make_branch_and_tree('.') |
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
188 |
|
189 |
lf = LogCatcher() |
|
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
190 |
log.show_log(wt.branch, lf) |
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
191 |
# no entries yet
|
|
4325.4.4
by Vincent Ladeuil
Clarify LogCatcher purpose. |
192 |
self.assertEqual([], lf.revisions) |
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
193 |
|
194 |
def test_empty_commit(self): |
|
195 |
wt = self.make_branch_and_tree('.') |
|
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
196 |
|
|
1534.4.36
by Robert Collins
Finish deprecating Branch.working_tree() |
197 |
wt.commit('empty commit') |
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
198 |
lf = LogCatcher() |
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
199 |
log.show_log(wt.branch, lf, verbose=True) |
|
4325.4.4
by Vincent Ladeuil
Clarify LogCatcher purpose. |
200 |
revs = lf.revisions |
201 |
self.assertEqual(1, len(revs)) |
|
202 |
self.assertEqual('1', revs[0].revno) |
|
203 |
self.assertEqual('empty commit', revs[0].rev.message) |
|
204 |
self.checkDelta(revs[0].delta) |
|
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
205 |
|
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
206 |
def test_simple_commit(self): |
207 |
wt = self.make_branch_and_tree('.') |
|
208 |
wt.commit('empty commit') |
|
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
209 |
self.build_tree(['hello']) |
|
1534.4.36
by Robert Collins
Finish deprecating Branch.working_tree() |
210 |
wt.add('hello') |
|
2717.1.1
by Lukáš Lalinsky
Use UTF-8 encoded StringIO for log tests to avoid failures on non-ASCII committer names. |
211 |
wt.commit('add one file', |
212 |
committer=u'\u013d\xf3r\xe9m \xcdp\u0161\xfam ' |
|
213 |
u'<test@example.com>') |
|
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
214 |
lf = LogCatcher() |
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
215 |
log.show_log(wt.branch, lf, verbose=True) |
|
4325.4.4
by Vincent Ladeuil
Clarify LogCatcher purpose. |
216 |
self.assertEqual(2, len(lf.revisions)) |
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
217 |
# first one is most recent
|
|
4325.4.4
by Vincent Ladeuil
Clarify LogCatcher purpose. |
218 |
log_entry = lf.revisions[0] |
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
219 |
self.assertEqual('2', log_entry.revno) |
220 |
self.assertEqual('add one file', log_entry.rev.message) |
|
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
221 |
self.checkDelta(log_entry.delta, added=['hello']) |
|
3831.1.6
by John Arbash Meinel
For the simple-log tests, avoid using '\r' in the test. |
222 |
|
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
223 |
def test_commit_message_with_control_chars(self): |
224 |
wt = self.make_branch_and_tree('.') |
|
|
3831.1.6
by John Arbash Meinel
For the simple-log tests, avoid using '\r' in the test. |
225 |
msg = u"All 8-bit chars: " + ''.join([unichr(x) for x in range(256)]) |
226 |
msg = msg.replace(u'\r', u'\n') |
|
|
1534.4.36
by Robert Collins
Finish deprecating Branch.working_tree() |
227 |
wt.commit(msg) |
|
1185.11.5
by John Arbash Meinel
Merged up-to-date against mainline, still broken. |
228 |
lf = LogCatcher() |
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
229 |
log.show_log(wt.branch, lf, verbose=True) |
|
4325.4.4
by Vincent Ladeuil
Clarify LogCatcher purpose. |
230 |
committed_msg = lf.revisions[0].rev.message |
|
4627.1.1
by Robert Collins
Review feedback per IanC. |
231 |
if wt.branch.repository._serializer.squashes_xml_invalid_characters: |
232 |
self.assertNotEqual(msg, committed_msg) |
|
233 |
self.assertTrue(len(committed_msg) > len(msg)) |
|
234 |
else: |
|
235 |
self.assertEqual(msg, committed_msg) |
|
|
1393.4.2
by Harald Meland
Cleanup + better test of commit-msg control character escape code. |
236 |
|
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
237 |
def test_commit_message_without_control_chars(self): |
238 |
wt = self.make_branch_and_tree('.') |
|
|
1393.4.2
by Harald Meland
Cleanup + better test of commit-msg control character escape code. |
239 |
# escaped. As ElementTree apparently does some kind of
|
240 |
# newline conversion, neither LF (\x0A) nor CR (\x0D) are
|
|
241 |
# included in the test commit message, even though they are
|
|
242 |
# valid XML 1.0 characters.
|
|
243 |
msg = "\x09" + ''.join([unichr(x) for x in range(0x20, 256)]) |
|
|
1534.4.36
by Robert Collins
Finish deprecating Branch.working_tree() |
244 |
wt.commit(msg) |
|
1393.4.2
by Harald Meland
Cleanup + better test of commit-msg control character escape code. |
245 |
lf = LogCatcher() |
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
246 |
log.show_log(wt.branch, lf, verbose=True) |
|
4325.4.4
by Vincent Ladeuil
Clarify LogCatcher purpose. |
247 |
committed_msg = lf.revisions[0].rev.message |
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
248 |
self.assertEqual(msg, committed_msg) |
|
1185.31.22
by John Arbash Meinel
[merge] bzr.dev |
249 |
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
250 |
def test_deltas_in_merge_revisions(self): |
251 |
"""Check deltas created for both mainline and merge revisions""" |
|
252 |
wt = self.make_branch_and_tree('parent') |
|
253 |
self.build_tree(['parent/file1', 'parent/file2', 'parent/file3']) |
|
254 |
wt.add('file1') |
|
255 |
wt.add('file2') |
|
256 |
wt.commit(message='add file1 and file2') |
|
|
2581.1.6
by Martin Pool
fix up more run_bzr callers |
257 |
self.run_bzr('branch parent child') |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
258 |
os.unlink('child/file1') |
|
6973.7.5
by Jelmer Vernooij
s/file/open. |
259 |
with open('child/file2', 'wb') as f: f.write(b'hello\n') |
|
2581.1.6
by Martin Pool
fix up more run_bzr callers |
260 |
self.run_bzr(['commit', '-m', 'remove file1 and modify file2', |
261 |
'child']) |
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
262 |
os.chdir('parent') |
|
2581.1.6
by Martin Pool
fix up more run_bzr callers |
263 |
self.run_bzr('merge ../child') |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
264 |
wt.commit('merge child branch') |
265 |
os.chdir('..') |
|
266 |
b = wt.branch |
|
267 |
lf = LogCatcher() |
|
268 |
lf.supports_merge_revisions = True |
|
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
269 |
log.show_log(b, lf, verbose=True) |
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
270 |
|
|
4325.4.4
by Vincent Ladeuil
Clarify LogCatcher purpose. |
271 |
revs = lf.revisions |
272 |
self.assertEqual(3, len(revs)) |
|
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
273 |
|
|
4325.4.4
by Vincent Ladeuil
Clarify LogCatcher purpose. |
274 |
logentry = revs[0] |
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
275 |
self.assertEqual('2', logentry.revno) |
276 |
self.assertEqual('merge child branch', logentry.rev.message) |
|
277 |
self.checkDelta(logentry.delta, removed=['file1'], modified=['file2']) |
|
278 |
||
|
4325.4.4
by Vincent Ladeuil
Clarify LogCatcher purpose. |
279 |
logentry = revs[1] |
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
280 |
self.assertEqual('1.1.1', logentry.revno) |
281 |
self.assertEqual('remove file1 and modify file2', logentry.rev.message) |
|
282 |
self.checkDelta(logentry.delta, removed=['file1'], modified=['file2']) |
|
283 |
||
|
4325.4.4
by Vincent Ladeuil
Clarify LogCatcher purpose. |
284 |
logentry = revs[2] |
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
285 |
self.assertEqual('1', logentry.revno) |
286 |
self.assertEqual('add file1 and file2', logentry.rev.message) |
|
287 |
self.checkDelta(logentry.delta, added=['file1', 'file2']) |
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
288 |
|
|
6129.2.1
by Martin von Gagern
Test case exposing bug #842695. |
289 |
def test_bug_842695_log_restricted_to_dir(self): |
290 |
# Comments here indicate revision numbers in trunk # VVVVV
|
|
291 |
trunk = self.make_branch_and_tree('this') |
|
292 |
trunk.commit('initial trunk') # 1 |
|
|
6833.5.1
by Jelmer Vernooij
Merge lp:~gagern/bzr/bug842695-log-dir. |
293 |
adder = trunk.controldir.sprout('adder').open_workingtree() |
294 |
merger = trunk.controldir.sprout('merger').open_workingtree() |
|
|
6129.2.1
by Martin von Gagern
Test case exposing bug #842695. |
295 |
self.build_tree_contents([ |
296 |
('adder/dir/',), |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
297 |
('adder/dir/file', b'foo'), |
|
6129.2.1
by Martin von Gagern
Test case exposing bug #842695. |
298 |
])
|
299 |
adder.add(['dir', 'dir/file']) |
|
300 |
adder.commit('added dir') # 1.1.1 |
|
301 |
trunk.merge_from_branch(adder.branch) |
|
302 |
trunk.commit('merged adder into trunk') # 2 |
|
303 |
merger.merge_from_branch(trunk.branch) |
|
304 |
merger.commit('merged trunk into merger') # 1.2.1 |
|
305 |
# Commits are processed in increments of 200 revisions, so
|
|
306 |
# make sure the two merges into trunk are in different chunks.
|
|
|
7029.4.8
by Jelmer Vernooij
Merge trunk. |
307 |
for i in range(200): |
|
6129.2.1
by Martin von Gagern
Test case exposing bug #842695. |
308 |
trunk.commit('intermediate commit %d' % i) # 3-202 |
309 |
trunk.merge_from_branch(merger.branch) |
|
310 |
trunk.commit('merged merger into trunk') # 203 |
|
311 |
file_id = trunk.path2id('dir') |
|
312 |
lf = LogCatcher() |
|
313 |
lf.supports_merge_revisions = True |
|
314 |
log.show_log(trunk.branch, lf, file_id) |
|
|
6833.5.1
by Jelmer Vernooij
Merge lp:~gagern/bzr/bug842695-log-dir. |
315 |
try: |
316 |
self.assertEqual(['2', '1.1.1'], [r.revno for r in lf.revisions]) |
|
317 |
except AssertionError: |
|
318 |
raise tests.KnownFailure("bug #842695") |
|
319 |
||
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
320 |
|
|
6583.4.5
by Reagan Sanders
Added a test case covering the possibility of UTF-8 characters within the name portion of a GPG key. This can happen during a 'bzr log --signatures' command. |
321 |
class TestFormatSignatureValidity(tests.TestCaseWithTransport): |
|
6883.11.3
by Jelmer Vernooij
Fix tests. |
322 |
|
323 |
def verify_revision_signature(self, revid, gpg_strategy): |
|
324 |
return (gpg.SIGNATURE_VALID, |
|
325 |
u'UTF8 Test \xa1\xb1\xc1\xd1\xe1\xf1 <jrandom@example.com>') |
|
|
6583.4.5
by Reagan Sanders
Added a test case covering the possibility of UTF-8 characters within the name portion of a GPG key. This can happen during a 'bzr log --signatures' command. |
326 |
|
327 |
def test_format_signature_validity_utf(self): |
|
328 |
"""Check that GPG signatures containing UTF-8 names are formatted |
|
329 |
correctly."""
|
|
330 |
wt = self.make_branch_and_tree('.') |
|
331 |
revid = wt.commit('empty commit') |
|
332 |
repo = wt.branch.repository |
|
333 |
# Monkey patch out checking if this rev is actually signed, since we
|
|
334 |
# can't sign it without a heavier TestCase and LoopbackGPGStrategy
|
|
335 |
# doesn't care anyways.
|
|
|
6883.11.3
by Jelmer Vernooij
Fix tests. |
336 |
self.overrideAttr(repo, 'verify_revision_signature', |
337 |
self.verify_revision_signature) |
|
|
6767.1.2
by Jelmer Vernooij
Fix a test. |
338 |
out = log.format_signature_validity(revid, wt.branch) |
|
6583.4.5
by Reagan Sanders
Added a test case covering the possibility of UTF-8 characters within the name portion of a GPG key. This can happen during a 'bzr log --signatures' command. |
339 |
self.assertEqual( |
340 |
u'valid signature from UTF8 Test \xa1\xb1\xc1\xd1\xe1\xf1 <jrandom@example.com>', |
|
341 |
out) |
|
|
6129.2.1
by Martin von Gagern
Test case exposing bug #842695. |
342 |
|
|
6583.4.5
by Reagan Sanders
Added a test case covering the possibility of UTF-8 characters within the name portion of a GPG key. This can happen during a 'bzr log --signatures' command. |
343 |
|
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
344 |
class TestShortLogFormatter(TestCaseForLogFormatter): |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
345 |
|
|
1185.31.21
by John Arbash Meinel
Added test for log formatting, found bug when redirecting short logs to a file instead of stdout. |
346 |
def test_trailing_newlines(self): |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
347 |
wt = self.make_branch_and_tree('.') |
|
4955.4.1
by Vincent Ladeuil
Refactor the function into an helper. |
348 |
b = self.make_commits_with_trailing_newlines(wt) |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
349 |
self.assertFormatterResult(b"""\ |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
350 |
3 Joe Foo\t2005-11-22 |
|
1185.31.21
by John Arbash Meinel
Added test for log formatting, found bug when redirecting short logs to a file instead of stdout. |
351 |
single line with trailing newline
|
352 |
||
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
353 |
2 Joe Foo\t2005-11-22 |
|
1185.31.21
by John Arbash Meinel
Added test for log formatting, found bug when redirecting short logs to a file instead of stdout. |
354 |
multiline
|
355 |
log
|
|
356 |
message
|
|
357 |
||
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
358 |
1 Joe Foo\t2005-11-22 |
|
1185.31.21
by John Arbash Meinel
Added test for log formatting, found bug when redirecting short logs to a file instead of stdout. |
359 |
simple log message
|
360 |
||
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
361 |
""", |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
362 |
b, log.ShortLogFormatter) |
|
1185.31.21
by John Arbash Meinel
Added test for log formatting, found bug when redirecting short logs to a file instead of stdout. |
363 |
|
|
2997.1.1
by Kent Gibson
Support logging single merge revisions with short and line log formatters. |
364 |
def test_short_log_with_merges(self): |
|
3946.3.2
by Ian Clatworthy
add tests & NEWS item |
365 |
wt = self._prepare_tree_with_merges() |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
366 |
self.assertFormatterResult(b"""\ |
|
2997.1.1
by Kent Gibson
Support logging single merge revisions with short and line log formatters. |
367 |
2 Joe Foo\t2005-11-22 [merge] |
368 |
rev-2
|
|
369 |
||
370 |
1 Joe Foo\t2005-11-22 |
|
371 |
rev-1
|
|
372 |
||
|
4221.2.3
by Ian Clatworthy
jam feedback: don't show advice if --levels explicitly given |
373 |
""", |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
374 |
wt.branch, log.ShortLogFormatter) |
|
4221.2.3
by Ian Clatworthy
jam feedback: don't show advice if --levels explicitly given |
375 |
|
376 |
def test_short_log_with_merges_and_advice(self): |
|
377 |
wt = self._prepare_tree_with_merges() |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
378 |
self.assertFormatterResult(b"""\ |
|
4221.2.3
by Ian Clatworthy
jam feedback: don't show advice if --levels explicitly given |
379 |
2 Joe Foo\t2005-11-22 [merge] |
380 |
rev-2
|
|
381 |
||
382 |
1 Joe Foo\t2005-11-22 |
|
383 |
rev-1
|
|
384 |
||
|
6123.11.13
by Martin von Gagern
Rename --include-sidelines to --include-merged. |
385 |
Use --include-merged or -n0 to see merged revisions.
|
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
386 |
""", |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
387 |
wt.branch, log.ShortLogFormatter, |
388 |
formatter_kwargs=dict(show_advice=True)) |
|
|
2997.1.1
by Kent Gibson
Support logging single merge revisions with short and line log formatters. |
389 |
|
|
3943.4.2
by John Arbash Meinel
Add a test case which exercises this code path. |
390 |
def test_short_log_with_merges_and_range(self): |
|
4955.4.19
by Vincent Ladeuil
Less code duplication. |
391 |
wt = self._prepare_tree_with_merges() |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
392 |
self.wt_commit(wt, 'rev-3a', rev_id=b'rev-3a') |
|
6973.10.6
by Jelmer Vernooij
Fix tests. |
393 |
wt.branch.set_last_revision_info(2, b'rev-2b') |
394 |
wt.set_parent_ids([b'rev-2b', b'rev-3a']) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
395 |
self.wt_commit(wt, 'rev-3b', rev_id=b'rev-3b') |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
396 |
self.assertFormatterResult(b"""\ |
|
3943.4.2
by John Arbash Meinel
Add a test case which exercises this code path. |
397 |
3 Joe Foo\t2005-11-22 [merge] |
398 |
rev-3b
|
|
399 |
||
400 |
2 Joe Foo\t2005-11-22 [merge] |
|
|
4955.4.19
by Vincent Ladeuil
Less code duplication. |
401 |
rev-2
|
|
3943.4.2
by John Arbash Meinel
Add a test case which exercises this code path. |
402 |
|
403 |
""", |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
404 |
wt.branch, log.ShortLogFormatter, |
405 |
show_log_kwargs=dict(start_revision=2, end_revision=3)) |
|
|
3943.4.2
by John Arbash Meinel
Add a test case which exercises this code path. |
406 |
|
|
3946.3.2
by Ian Clatworthy
add tests & NEWS item |
407 |
def test_short_log_with_tags(self): |
408 |
wt = self._prepare_tree_with_merges(with_tags=True) |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
409 |
self.assertFormatterResult(b"""\ |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
410 |
3 Joe Foo\t2005-11-22 {v1.0, v1.0rc1} |
|
3946.3.2
by Ian Clatworthy
add tests & NEWS item |
411 |
rev-3
|
412 |
||
413 |
2 Joe Foo\t2005-11-22 {v0.2} [merge] |
|
414 |
rev-2
|
|
415 |
||
416 |
1 Joe Foo\t2005-11-22 |
|
417 |
rev-1
|
|
418 |
||
419 |
""", |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
420 |
wt.branch, log.ShortLogFormatter) |
|
3946.3.2
by Ian Clatworthy
add tests & NEWS item |
421 |
|
|
2997.1.1
by Kent Gibson
Support logging single merge revisions with short and line log formatters. |
422 |
def test_short_log_single_merge_revision(self): |
|
4955.4.19
by Vincent Ladeuil
Less code duplication. |
423 |
wt = self._prepare_tree_with_merges() |
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
424 |
revspec = revisionspec.RevisionSpec.from_string('1.1.1') |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
425 |
rev = revspec.in_history(wt.branch) |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
426 |
self.assertFormatterResult(b"""\ |
|
3947.1.10
by Ian Clatworthy
review feedback from vila |
427 |
1.1.1 Joe Foo\t2005-11-22 |
428 |
rev-merged
|
|
|
2997.1.1
by Kent Gibson
Support logging single merge revisions with short and line log formatters. |
429 |
|
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
430 |
""", |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
431 |
wt.branch, log.ShortLogFormatter, |
432 |
show_log_kwargs=dict(start_revision=rev, end_revision=rev)) |
|
433 |
||
|
5728.1.1
by Matt Giuca
test_log: Added test cases for the --show-ids switch on 'long' and 'short' log |
434 |
def test_show_ids(self): |
435 |
wt = self.make_branch_and_tree('parent') |
|
436 |
self.build_tree(['parent/f1', 'parent/f2']) |
|
|
6809.1.1
by Martin
Apply 2to3 ws_comma fixer |
437 |
wt.add(['f1', 'f2']) |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
438 |
self.wt_commit(wt, 'first post', rev_id=b'a') |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
439 |
child_wt = wt.controldir.sprout('child').open_workingtree() |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
440 |
self.wt_commit(child_wt, 'branch 1 changes', rev_id=b'b') |
|
5728.1.1
by Matt Giuca
test_log: Added test cases for the --show-ids switch on 'long' and 'short' log |
441 |
wt.merge_from_branch(child_wt.branch) |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
442 |
self.wt_commit(wt, 'merge branch 1', rev_id=b'c') |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
443 |
self.assertFormatterResult(b"""\ |
|
5728.1.1
by Matt Giuca
test_log: Added test cases for the --show-ids switch on 'long' and 'short' log |
444 |
2 Joe Foo\t2005-11-22 [merge] |
445 |
revision-id:c
|
|
446 |
merge branch 1
|
|
447 |
||
448 |
1.1.1 Joe Foo\t2005-11-22 |
|
449 |
revision-id:b
|
|
450 |
branch 1 changes
|
|
451 |
||
452 |
1 Joe Foo\t2005-11-22 |
|
453 |
revision-id:a
|
|
454 |
first post
|
|
455 |
||
456 |
""", |
|
457 |
wt.branch, log.ShortLogFormatter, |
|
|
6809.1.1
by Martin
Apply 2to3 ws_comma fixer |
458 |
formatter_kwargs=dict(levels=0, show_ids=True)) |
|
5728.1.1
by Matt Giuca
test_log: Added test cases for the --show-ids switch on 'long' and 'short' log |
459 |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
460 |
|
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
461 |
class TestShortLogFormatterWithMergeRevisions(TestCaseForLogFormatter): |
|
3947.1.2
by Ian Clatworthy
formatter tests |
462 |
|
463 |
def test_short_merge_revs_log_with_merges(self): |
|
|
4955.4.19
by Vincent Ladeuil
Less code duplication. |
464 |
wt = self._prepare_tree_with_merges() |
|
3947.1.7
by Ian Clatworthy
tweak indenting/offsetting for --short given dotted revno lengths |
465 |
# Note that the 1.1.1 indenting is in fact correct given that
|
466 |
# the revision numbers are right justified within 5 characters
|
|
467 |
# for mainline revnos and 9 characters for dotted revnos.
|
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
468 |
self.assertFormatterResult(b"""\ |
|
3947.1.2
by Ian Clatworthy
formatter tests |
469 |
2 Joe Foo\t2005-11-22 [merge] |
470 |
rev-2
|
|
471 |
||
|
3947.1.10
by Ian Clatworthy
review feedback from vila |
472 |
1.1.1 Joe Foo\t2005-11-22 |
473 |
rev-merged
|
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
474 |
|
475 |
1 Joe Foo\t2005-11-22 |
|
476 |
rev-1
|
|
477 |
||
478 |
""", |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
479 |
wt.branch, log.ShortLogFormatter, |
480 |
formatter_kwargs=dict(levels=0)) |
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
481 |
|
482 |
def test_short_merge_revs_log_single_merge_revision(self): |
|
|
4955.4.19
by Vincent Ladeuil
Less code duplication. |
483 |
wt = self._prepare_tree_with_merges() |
|
3947.1.2
by Ian Clatworthy
formatter tests |
484 |
revspec = revisionspec.RevisionSpec.from_string('1.1.1') |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
485 |
rev = revspec.in_history(wt.branch) |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
486 |
self.assertFormatterResult(b"""\ |
|
3947.1.10
by Ian Clatworthy
review feedback from vila |
487 |
1.1.1 Joe Foo\t2005-11-22 |
488 |
rev-merged
|
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
489 |
|
490 |
""", |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
491 |
wt.branch, log.ShortLogFormatter, |
492 |
formatter_kwargs=dict(levels=0), |
|
493 |
show_log_kwargs=dict(start_revision=rev, end_revision=rev)) |
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
494 |
|
495 |
||
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
496 |
class TestLongLogFormatter(TestCaseForLogFormatter): |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
497 |
|
|
1185.33.41
by Martin Pool
Fix regression of 'bzr log -v' - it wasn't showing changed files at all. (#4676) |
498 |
def test_verbose_log(self): |
499 |
"""Verbose log includes changed files |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
500 |
|
|
1185.33.41
by Martin Pool
Fix regression of 'bzr log -v' - it wasn't showing changed files at all. (#4676) |
501 |
bug #4676
|
502 |
"""
|
|
|
4857.4.4
by John Arbash Meinel
One more standard-commit |
503 |
wt = self.make_standard_commit('test_verbose_log', authors=[]) |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
504 |
self.assertFormatterResult(b'''\ |
|
1185.33.41
by Martin Pool
Fix regression of 'bzr log -v' - it wasn't showing changed files at all. (#4676) |
505 |
------------------------------------------------------------
|
506 |
revno: 1
|
|
|
2671.5.7
by Lukáš Lalinsky
Rename get_author to get_apparent_author, revert the long log back to displaying the committer. |
507 |
committer: Lorem Ipsum <test@example.com>
|
|
1185.33.41
by Martin Pool
Fix regression of 'bzr log -v' - it wasn't showing changed files at all. (#4676) |
508 |
branch nick: test_verbose_log
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
509 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
1185.33.41
by Martin Pool
Fix regression of 'bzr log -v' - it wasn't showing changed files at all. (#4676) |
510 |
message:
|
511 |
add a
|
|
512 |
added:
|
|
513 |
a
|
|
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
514 |
''', |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
515 |
wt.branch, log.LongLogFormatter, |
|
4857.4.5
by John Arbash Meinel
We don't need the utf8 option, no test actually wanted to run without it, |
516 |
show_log_kwargs=dict(verbose=True)) |
|
1185.85.4
by John Arbash Meinel
currently broken, trying to fix things up. |
517 |
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
518 |
def test_merges_are_indented_by_level(self): |
519 |
wt = self.make_branch_and_tree('parent') |
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
520 |
self.wt_commit(wt, 'first post') |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
521 |
child_wt = wt.controldir.sprout('child').open_workingtree() |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
522 |
self.wt_commit(child_wt, 'branch 1') |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
523 |
smallerchild_wt = wt.controldir.sprout('smallerchild').open_workingtree() |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
524 |
self.wt_commit(smallerchild_wt, 'branch 2') |
525 |
child_wt.merge_from_branch(smallerchild_wt.branch) |
|
526 |
self.wt_commit(child_wt, 'merge branch 2') |
|
527 |
wt.merge_from_branch(child_wt.branch) |
|
528 |
self.wt_commit(wt, 'merge branch 1') |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
529 |
self.assertFormatterResult(b"""\ |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
530 |
------------------------------------------------------------
|
|
4208.2.1
by Ian Clatworthy
merge indicators in log --long |
531 |
revno: 2 [merge]
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
532 |
committer: Joe Foo <joe@foo.com>
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
533 |
branch nick: parent
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
534 |
timestamp: Tue 2005-11-22 00:00:04 +0000
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
535 |
message:
|
536 |
merge branch 1
|
|
537 |
------------------------------------------------------------
|
|
|
4208.2.1
by Ian Clatworthy
merge indicators in log --long |
538 |
revno: 1.1.2 [merge]
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
539 |
committer: Joe Foo <joe@foo.com>
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
540 |
branch nick: child
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
541 |
timestamp: Tue 2005-11-22 00:00:03 +0000
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
542 |
message:
|
543 |
merge branch 2
|
|
544 |
------------------------------------------------------------
|
|
|
3170.3.4
by John Arbash Meinel
Update the tests for the new revision numbering. |
545 |
revno: 1.2.1
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
546 |
committer: Joe Foo <joe@foo.com>
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
547 |
branch nick: smallerchild
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
548 |
timestamp: Tue 2005-11-22 00:00:02 +0000
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
549 |
message:
|
550 |
branch 2
|
|
551 |
------------------------------------------------------------
|
|
552 |
revno: 1.1.1
|
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
553 |
committer: Joe Foo <joe@foo.com>
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
554 |
branch nick: child
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
555 |
timestamp: Tue 2005-11-22 00:00:01 +0000
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
556 |
message:
|
557 |
branch 1
|
|
558 |
------------------------------------------------------------
|
|
559 |
revno: 1
|
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
560 |
committer: Joe Foo <joe@foo.com>
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
561 |
branch nick: parent
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
562 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
563 |
message:
|
564 |
first post
|
|
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
565 |
""", |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
566 |
wt.branch, log.LongLogFormatter, |
567 |
formatter_kwargs=dict(levels=0), |
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
568 |
show_log_kwargs=dict(verbose=True)) |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
569 |
|
570 |
def test_verbose_merge_revisions_contain_deltas(self): |
|
571 |
wt = self.make_branch_and_tree('parent') |
|
572 |
self.build_tree(['parent/f1', 'parent/f2']) |
|
|
6809.1.1
by Martin
Apply 2to3 ws_comma fixer |
573 |
wt.add(['f1', 'f2']) |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
574 |
self.wt_commit(wt, 'first post') |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
575 |
child_wt = wt.controldir.sprout('child').open_workingtree() |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
576 |
os.unlink('child/f1') |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
577 |
self.build_tree_contents([('child/f2', b'hello\n')]) |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
578 |
self.wt_commit(child_wt, 'removed f1 and modified f2') |
579 |
wt.merge_from_branch(child_wt.branch) |
|
580 |
self.wt_commit(wt, 'merge branch 1') |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
581 |
self.assertFormatterResult(b"""\ |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
582 |
------------------------------------------------------------
|
|
4208.2.1
by Ian Clatworthy
merge indicators in log --long |
583 |
revno: 2 [merge]
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
584 |
committer: Joe Foo <joe@foo.com>
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
585 |
branch nick: parent
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
586 |
timestamp: Tue 2005-11-22 00:00:02 +0000
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
587 |
message:
|
588 |
merge branch 1
|
|
589 |
removed:
|
|
590 |
f1
|
|
591 |
modified:
|
|
592 |
f2
|
|
593 |
------------------------------------------------------------
|
|
594 |
revno: 1.1.1
|
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
595 |
committer: Joe Foo <joe@foo.com>
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
596 |
branch nick: child
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
597 |
timestamp: Tue 2005-11-22 00:00:01 +0000
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
598 |
message:
|
599 |
removed f1 and modified f2
|
|
600 |
removed:
|
|
601 |
f1
|
|
602 |
modified:
|
|
603 |
f2
|
|
604 |
------------------------------------------------------------
|
|
605 |
revno: 1
|
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
606 |
committer: Joe Foo <joe@foo.com>
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
607 |
branch nick: parent
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
608 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
609 |
message:
|
610 |
first post
|
|
611 |
added:
|
|
612 |
f1
|
|
613 |
f2
|
|
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
614 |
""", |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
615 |
wt.branch, log.LongLogFormatter, |
616 |
formatter_kwargs=dict(levels=0), |
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
617 |
show_log_kwargs=dict(verbose=True)) |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
618 |
|
619 |
def test_trailing_newlines(self): |
|
620 |
wt = self.make_branch_and_tree('.') |
|
|
4955.4.1
by Vincent Ladeuil
Refactor the function into an helper. |
621 |
b = self.make_commits_with_trailing_newlines(wt) |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
622 |
self.assertFormatterResult(b"""\ |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
623 |
------------------------------------------------------------
|
624 |
revno: 3
|
|
|
2671.5.7
by Lukáš Lalinsky
Rename get_author to get_apparent_author, revert the long log back to displaying the committer. |
625 |
committer: Joe Foo <joe@foo.com>
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
626 |
branch nick: test
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
627 |
timestamp: Tue 2005-11-22 00:00:02 +0000
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
628 |
message:
|
629 |
single line with trailing newline
|
|
630 |
------------------------------------------------------------
|
|
631 |
revno: 2
|
|
632 |
committer: Joe Foo <joe@foo.com>
|
|
633 |
branch nick: test
|
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
634 |
timestamp: Tue 2005-11-22 00:00:01 +0000
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
635 |
message:
|
636 |
multiline
|
|
637 |
log
|
|
638 |
message
|
|
639 |
------------------------------------------------------------
|
|
640 |
revno: 1
|
|
|
2671.5.7
by Lukáš Lalinsky
Rename get_author to get_apparent_author, revert the long log back to displaying the committer. |
641 |
committer: Joe Foo <joe@foo.com>
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
642 |
branch nick: test
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
643 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
644 |
message:
|
645 |
simple log message
|
|
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
646 |
""", |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
647 |
b, log.LongLogFormatter) |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
648 |
|
|
2671.5.7
by Lukáš Lalinsky
Rename get_author to get_apparent_author, revert the long log back to displaying the committer. |
649 |
def test_author_in_log(self): |
650 |
"""Log includes the author name if it's set in |
|
651 |
the revision properties
|
|
|
2671.2.1
by Lukáš Lalinský
Add --author option to 'bzr commit' to record the author's name, if it's different from the committer. |
652 |
"""
|
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
653 |
wt = self.make_standard_commit('test_author_log', |
654 |
authors=['John Doe <jdoe@example.com>', |
|
655 |
'Jane Rey <jrey@example.com>']) |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
656 |
self.assertFormatterResult(b"""\ |
|
2671.2.1
by Lukáš Lalinský
Add --author option to 'bzr commit' to record the author's name, if it's different from the committer. |
657 |
------------------------------------------------------------
|
658 |
revno: 1
|
|
|
4056.2.3
by James Westby
Use a new "authors" revision property to allow multiple authors |
659 |
author: John Doe <jdoe@example.com>, Jane Rey <jrey@example.com>
|
|
2671.5.4
by Lukáš Lalinsky
Replace the committer with the author in log, the committer is displayed only in the long format and only if it's different from the author. |
660 |
committer: Lorem Ipsum <test@example.com>
|
|
2671.2.1
by Lukáš Lalinský
Add --author option to 'bzr commit' to record the author's name, if it's different from the committer. |
661 |
branch nick: test_author_log
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
662 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
2671.2.1
by Lukáš Lalinský
Add --author option to 'bzr commit' to record the author's name, if it's different from the committer. |
663 |
message:
|
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
664 |
add a
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
665 |
""", |
|
4857.4.5
by John Arbash Meinel
We don't need the utf8 option, no test actually wanted to run without it, |
666 |
wt.branch, log.LongLogFormatter) |
|
2671.2.1
by Lukáš Lalinský
Add --author option to 'bzr commit' to record the author's name, if it's different from the committer. |
667 |
|
|
3144.7.9
by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors |
668 |
def test_properties_in_log(self): |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
669 |
"""Log includes the custom properties returned by the registered |
|
3144.7.9
by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors |
670 |
handlers.
|
671 |
"""
|
|
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
672 |
wt = self.make_standard_commit('test_properties_in_log') |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
673 |
def trivial_custom_prop_handler(revision): |
674 |
return {'test_prop':'test_value'} |
|
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
675 |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
676 |
# Cleaned up in setUp()
|
677 |
log.properties_handler_registry.register( |
|
678 |
'trivial_custom_prop_handler', |
|
679 |
trivial_custom_prop_handler) |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
680 |
self.assertFormatterResult(b"""\ |
|
3144.7.9
by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors |
681 |
------------------------------------------------------------
|
682 |
revno: 1
|
|
683 |
test_prop: test_value
|
|
684 |
author: John Doe <jdoe@example.com>
|
|
685 |
committer: Lorem Ipsum <test@example.com>
|
|
|
3144.7.13
by Guillermo Gonzalez
* fixed typo LogFormatter.show_properties in docstring |
686 |
branch nick: test_properties_in_log
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
687 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
3144.7.9
by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors |
688 |
message:
|
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
689 |
add a
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
690 |
""", |
|
4857.4.5
by John Arbash Meinel
We don't need the utf8 option, no test actually wanted to run without it, |
691 |
wt.branch, log.LongLogFormatter) |
|
3144.7.9
by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors |
692 |
|
|
3976.3.1
by Neil Martinsen-Burrell
Add custom properties handling to short log format |
693 |
def test_properties_in_short_log(self): |
|
4032.1.2
by John Arbash Meinel
Track down a few more files that have trailing whitespace. |
694 |
"""Log includes the custom properties returned by the registered |
|
3976.3.1
by Neil Martinsen-Burrell
Add custom properties handling to short log format |
695 |
handlers.
|
696 |
"""
|
|
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
697 |
wt = self.make_standard_commit('test_properties_in_short_log') |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
698 |
def trivial_custom_prop_handler(revision): |
699 |
return {'test_prop':'test_value'} |
|
|
3976.3.1
by Neil Martinsen-Burrell
Add custom properties handling to short log format |
700 |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
701 |
log.properties_handler_registry.register( |
702 |
'trivial_custom_prop_handler', |
|
703 |
trivial_custom_prop_handler) |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
704 |
self.assertFormatterResult(b"""\ |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
705 |
1 John Doe\t2005-11-22 |
|
3976.3.1
by Neil Martinsen-Burrell
Add custom properties handling to short log format |
706 |
test_prop: test_value
|
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
707 |
add a
|
|
3976.3.1
by Neil Martinsen-Burrell
Add custom properties handling to short log format |
708 |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
709 |
""", |
710 |
wt.branch, log.ShortLogFormatter) |
|
|
3976.3.1
by Neil Martinsen-Burrell
Add custom properties handling to short log format |
711 |
|
|
3144.7.9
by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors |
712 |
def test_error_in_properties_handler(self): |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
713 |
"""Log includes the custom properties returned by the registered |
|
3144.7.9
by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors |
714 |
handlers.
|
715 |
"""
|
|
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
716 |
wt = self.make_standard_commit('error_in_properties_handler', |
|
6973.12.5
by Jelmer Vernooij
Add some u's for revision property names. |
717 |
revprops={u'first_prop':'first_value'}) |
|
4857.4.5
by John Arbash Meinel
We don't need the utf8 option, no test actually wanted to run without it, |
718 |
sio = self.make_utf8_encoded_stringio() |
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
719 |
formatter = log.LongLogFormatter(to_file=sio) |
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
720 |
def trivial_custom_prop_handler(revision): |
|
6619.3.9
by Jelmer Vernooij
Run 2to3 standarderror fixer. |
721 |
raise Exception("a test error") |
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
722 |
|
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
723 |
log.properties_handler_registry.register( |
724 |
'trivial_custom_prop_handler', |
|
725 |
trivial_custom_prop_handler) |
|
|
6619.3.9
by Jelmer Vernooij
Run 2to3 standarderror fixer. |
726 |
self.assertRaises(Exception, log.show_log, wt.branch, formatter,) |
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
727 |
|
|
3144.7.13
by Guillermo Gonzalez
* fixed typo LogFormatter.show_properties in docstring |
728 |
def test_properties_handler_bad_argument(self): |
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
729 |
wt = self.make_standard_commit('bad_argument', |
|
6973.12.5
by Jelmer Vernooij
Add some u's for revision property names. |
730 |
revprops={u'a_prop':'test_value'}) |
|
4857.4.5
by John Arbash Meinel
We don't need the utf8 option, no test actually wanted to run without it, |
731 |
sio = self.make_utf8_encoded_stringio() |
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
732 |
formatter = log.LongLogFormatter(to_file=sio) |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
733 |
def bad_argument_prop_handler(revision): |
734 |
return {'custom_prop_name':revision.properties['a_prop']} |
|
735 |
||
736 |
log.properties_handler_registry.register( |
|
737 |
'bad_argument_prop_handler', |
|
738 |
bad_argument_prop_handler) |
|
739 |
||
740 |
self.assertRaises(AttributeError, formatter.show_properties, |
|
741 |
'a revision', '') |
|
742 |
||
743 |
revision = wt.branch.repository.get_revision(wt.branch.last_revision()) |
|
744 |
formatter.show_properties(revision, '') |
|
|
7067.13.1
by Jelmer Vernooij
Some more fixes for Python 3. |
745 |
self.assertEqualDiff(b'''custom_prop_name: test_value\n''', |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
746 |
sio.getvalue()) |
|
2671.2.1
by Lukáš Lalinský
Add --author option to 'bzr commit' to record the author's name, if it's different from the committer. |
747 |
|
|
5728.1.1
by Matt Giuca
test_log: Added test cases for the --show-ids switch on 'long' and 'short' log |
748 |
def test_show_ids(self): |
749 |
wt = self.make_branch_and_tree('parent') |
|
750 |
self.build_tree(['parent/f1', 'parent/f2']) |
|
|
6809.1.1
by Martin
Apply 2to3 ws_comma fixer |
751 |
wt.add(['f1', 'f2']) |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
752 |
self.wt_commit(wt, 'first post', rev_id=b'a') |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
753 |
child_wt = wt.controldir.sprout('child').open_workingtree() |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
754 |
self.wt_commit(child_wt, 'branch 1 changes', rev_id=b'b') |
|
5728.1.1
by Matt Giuca
test_log: Added test cases for the --show-ids switch on 'long' and 'short' log |
755 |
wt.merge_from_branch(child_wt.branch) |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
756 |
self.wt_commit(wt, 'merge branch 1', rev_id=b'c') |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
757 |
self.assertFormatterResult(b"""\ |
|
5728.1.1
by Matt Giuca
test_log: Added test cases for the --show-ids switch on 'long' and 'short' log |
758 |
------------------------------------------------------------
|
759 |
revno: 2 [merge]
|
|
760 |
revision-id: c
|
|
761 |
parent: a
|
|
762 |
parent: b
|
|
763 |
committer: Joe Foo <joe@foo.com>
|
|
764 |
branch nick: parent
|
|
765 |
timestamp: Tue 2005-11-22 00:00:02 +0000
|
|
766 |
message:
|
|
767 |
merge branch 1
|
|
768 |
------------------------------------------------------------
|
|
769 |
revno: 1.1.1
|
|
770 |
revision-id: b
|
|
771 |
parent: a
|
|
772 |
committer: Joe Foo <joe@foo.com>
|
|
773 |
branch nick: child
|
|
774 |
timestamp: Tue 2005-11-22 00:00:01 +0000
|
|
775 |
message:
|
|
776 |
branch 1 changes
|
|
777 |
------------------------------------------------------------
|
|
778 |
revno: 1
|
|
779 |
revision-id: a
|
|
780 |
committer: Joe Foo <joe@foo.com>
|
|
781 |
branch nick: parent
|
|
782 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
783 |
message:
|
|
784 |
first post
|
|
785 |
""", |
|
786 |
wt.branch, log.LongLogFormatter, |
|
|
6809.1.1
by Martin
Apply 2to3 ws_comma fixer |
787 |
formatter_kwargs=dict(levels=0, show_ids=True)) |
|
5728.1.1
by Matt Giuca
test_log: Added test cases for the --show-ids switch on 'long' and 'short' log |
788 |
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
789 |
|
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
790 |
class TestLongLogFormatterWithoutMergeRevisions(TestCaseForLogFormatter): |
|
3947.1.2
by Ian Clatworthy
formatter tests |
791 |
|
792 |
def test_long_verbose_log(self): |
|
793 |
"""Verbose log includes changed files |
|
|
4032.1.2
by John Arbash Meinel
Track down a few more files that have trailing whitespace. |
794 |
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
795 |
bug #4676
|
796 |
"""
|
|
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
797 |
wt = self.make_standard_commit('test_long_verbose_log', authors=[]) |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
798 |
self.assertFormatterResult(b"""\ |
|
3947.1.2
by Ian Clatworthy
formatter tests |
799 |
------------------------------------------------------------
|
800 |
revno: 1
|
|
801 |
committer: Lorem Ipsum <test@example.com>
|
|
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
802 |
branch nick: test_long_verbose_log
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
803 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
804 |
message:
|
805 |
add a
|
|
806 |
added:
|
|
807 |
a
|
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
808 |
""", |
809 |
wt.branch, log.LongLogFormatter, |
|
810 |
formatter_kwargs=dict(levels=1), |
|
|
4857.4.5
by John Arbash Meinel
We don't need the utf8 option, no test actually wanted to run without it, |
811 |
show_log_kwargs=dict(verbose=True)) |
|
3947.1.2
by Ian Clatworthy
formatter tests |
812 |
|
813 |
def test_long_verbose_contain_deltas(self): |
|
814 |
wt = self.make_branch_and_tree('parent') |
|
815 |
self.build_tree(['parent/f1', 'parent/f2']) |
|
|
6809.1.1
by Martin
Apply 2to3 ws_comma fixer |
816 |
wt.add(['f1', 'f2']) |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
817 |
self.wt_commit(wt, 'first post') |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
818 |
child_wt = wt.controldir.sprout('child').open_workingtree() |
|
3947.1.2
by Ian Clatworthy
formatter tests |
819 |
os.unlink('child/f1') |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
820 |
self.build_tree_contents([('child/f2', b'hello\n')]) |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
821 |
self.wt_commit(child_wt, 'removed f1 and modified f2') |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
822 |
wt.merge_from_branch(child_wt.branch) |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
823 |
self.wt_commit(wt, 'merge branch 1') |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
824 |
self.assertFormatterResult(b"""\ |
|
3947.1.2
by Ian Clatworthy
formatter tests |
825 |
------------------------------------------------------------
|
|
4208.2.1
by Ian Clatworthy
merge indicators in log --long |
826 |
revno: 2 [merge]
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
827 |
committer: Joe Foo <joe@foo.com>
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
828 |
branch nick: parent
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
829 |
timestamp: Tue 2005-11-22 00:00:02 +0000
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
830 |
message:
|
831 |
merge branch 1
|
|
832 |
removed:
|
|
833 |
f1
|
|
834 |
modified:
|
|
835 |
f2
|
|
836 |
------------------------------------------------------------
|
|
837 |
revno: 1
|
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
838 |
committer: Joe Foo <joe@foo.com>
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
839 |
branch nick: parent
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
840 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
841 |
message:
|
842 |
first post
|
|
843 |
added:
|
|
844 |
f1
|
|
845 |
f2
|
|
846 |
""", |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
847 |
wt.branch, log.LongLogFormatter, |
848 |
formatter_kwargs=dict(levels=1), |
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
849 |
show_log_kwargs=dict(verbose=True)) |
|
3947.1.2
by Ian Clatworthy
formatter tests |
850 |
|
851 |
def test_long_trailing_newlines(self): |
|
852 |
wt = self.make_branch_and_tree('.') |
|
|
4955.4.1
by Vincent Ladeuil
Refactor the function into an helper. |
853 |
b = self.make_commits_with_trailing_newlines(wt) |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
854 |
self.assertFormatterResult(b"""\ |
|
3947.1.2
by Ian Clatworthy
formatter tests |
855 |
------------------------------------------------------------
|
856 |
revno: 3
|
|
857 |
committer: Joe Foo <joe@foo.com>
|
|
858 |
branch nick: test
|
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
859 |
timestamp: Tue 2005-11-22 00:00:02 +0000
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
860 |
message:
|
861 |
single line with trailing newline
|
|
862 |
------------------------------------------------------------
|
|
863 |
revno: 2
|
|
864 |
committer: Joe Foo <joe@foo.com>
|
|
865 |
branch nick: test
|
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
866 |
timestamp: Tue 2005-11-22 00:00:01 +0000
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
867 |
message:
|
868 |
multiline
|
|
869 |
log
|
|
870 |
message
|
|
871 |
------------------------------------------------------------
|
|
872 |
revno: 1
|
|
873 |
committer: Joe Foo <joe@foo.com>
|
|
874 |
branch nick: test
|
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
875 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
876 |
message:
|
877 |
simple log message
|
|
878 |
""", |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
879 |
b, log.LongLogFormatter, |
880 |
formatter_kwargs=dict(levels=1)) |
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
881 |
|
882 |
def test_long_author_in_log(self): |
|
883 |
"""Log includes the author name if it's set in |
|
884 |
the revision properties
|
|
885 |
"""
|
|
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
886 |
wt = self.make_standard_commit('test_author_log') |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
887 |
self.assertFormatterResult(b"""\ |
|
3947.1.2
by Ian Clatworthy
formatter tests |
888 |
------------------------------------------------------------
|
889 |
revno: 1
|
|
890 |
author: John Doe <jdoe@example.com>
|
|
891 |
committer: Lorem Ipsum <test@example.com>
|
|
892 |
branch nick: test_author_log
|
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
893 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
894 |
message:
|
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
895 |
add a
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
896 |
""", |
897 |
wt.branch, log.LongLogFormatter, |
|
898 |
formatter_kwargs=dict(levels=1)) |
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
899 |
|
900 |
def test_long_properties_in_log(self): |
|
|
4032.1.2
by John Arbash Meinel
Track down a few more files that have trailing whitespace. |
901 |
"""Log includes the custom properties returned by the registered |
|
3947.1.2
by Ian Clatworthy
formatter tests |
902 |
handlers.
|
903 |
"""
|
|
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
904 |
wt = self.make_standard_commit('test_properties_in_log') |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
905 |
def trivial_custom_prop_handler(revision): |
906 |
return {'test_prop':'test_value'} |
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
907 |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
908 |
log.properties_handler_registry.register( |
909 |
'trivial_custom_prop_handler', |
|
910 |
trivial_custom_prop_handler) |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
911 |
self.assertFormatterResult(b"""\ |
|
3947.1.2
by Ian Clatworthy
formatter tests |
912 |
------------------------------------------------------------
|
913 |
revno: 1
|
|
914 |
test_prop: test_value
|
|
915 |
author: John Doe <jdoe@example.com>
|
|
916 |
committer: Lorem Ipsum <test@example.com>
|
|
917 |
branch nick: test_properties_in_log
|
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
918 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
919 |
message:
|
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
920 |
add a
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
921 |
""", |
922 |
wt.branch, log.LongLogFormatter, |
|
923 |
formatter_kwargs=dict(levels=1)) |
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
924 |
|
925 |
||
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
926 |
class TestLineLogFormatter(TestCaseForLogFormatter): |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
927 |
|
|
1704.2.20
by Martin Pool
log --line shows revision numbers (Alexander) |
928 |
def test_line_log(self): |
929 |
"""Line log should show revno |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
930 |
|
|
1704.2.20
by Martin Pool
log --line shows revision numbers (Alexander) |
931 |
bug #5162
|
932 |
"""
|
|
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
933 |
wt = self.make_standard_commit('test-line-log', |
934 |
committer='Line-Log-Formatter Tester <test@line.log>', |
|
935 |
authors=[]) |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
936 |
self.assertFormatterResult(b"""\ |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
937 |
1: Line-Log-Formatte... 2005-11-22 add a
|
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
938 |
""", |
939 |
wt.branch, log.LineLogFormatter) |
|
|
1756.2.20
by Aaron Bentley
Optimize log formats that don't show merges |
940 |
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
941 |
def test_trailing_newlines(self): |
942 |
wt = self.make_branch_and_tree('.') |
|
|
4955.4.1
by Vincent Ladeuil
Refactor the function into an helper. |
943 |
b = self.make_commits_with_trailing_newlines(wt) |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
944 |
self.assertFormatterResult(b"""\ |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
945 |
3: Joe Foo 2005-11-22 single line with trailing newline
|
946 |
2: Joe Foo 2005-11-22 multiline
|
|
947 |
1: Joe Foo 2005-11-22 simple log message
|
|
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
948 |
""", |
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
949 |
b, log.LineLogFormatter) |
|
3946.3.2
by Ian Clatworthy
add tests & NEWS item |
950 |
|
|
2997.1.1
by Kent Gibson
Support logging single merge revisions with short and line log formatters. |
951 |
def test_line_log_single_merge_revision(self): |
|
3946.3.2
by Ian Clatworthy
add tests & NEWS item |
952 |
wt = self._prepare_tree_with_merges() |
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
953 |
revspec = revisionspec.RevisionSpec.from_string('1.1.1') |
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
954 |
rev = revspec.in_history(wt.branch) |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
955 |
self.assertFormatterResult(b"""\ |
|
2997.1.1
by Kent Gibson
Support logging single merge revisions with short and line log formatters. |
956 |
1.1.1: Joe Foo 2005-11-22 rev-merged
|
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
957 |
""", |
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
958 |
wt.branch, log.LineLogFormatter, |
959 |
show_log_kwargs=dict(start_revision=rev, end_revision=rev)) |
|
|
2997.1.1
by Kent Gibson
Support logging single merge revisions with short and line log formatters. |
960 |
|
|
3946.3.2
by Ian Clatworthy
add tests & NEWS item |
961 |
def test_line_log_with_tags(self): |
962 |
wt = self._prepare_tree_with_merges(with_tags=True) |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
963 |
self.assertFormatterResult(b"""\ |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
964 |
3: Joe Foo 2005-11-22 {v1.0, v1.0rc1} rev-3
|
|
3983.2.1
by Neil Martinsen-Burrell
add merge indication to the line format |
965 |
2: Joe Foo 2005-11-22 [merge] {v0.2} rev-2 |
|
3946.3.2
by Ian Clatworthy
add tests & NEWS item |
966 |
1: Joe Foo 2005-11-22 rev-1
|
967 |
""", |
|
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
968 |
wt.branch, log.LineLogFormatter) |
969 |
||
970 |
||
971 |
class TestLineLogFormatterWithMergeRevisions(TestCaseForLogFormatter): |
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
972 |
|
973 |
def test_line_merge_revs_log(self): |
|
974 |
"""Line log should show revno |
|
|
4032.1.2
by John Arbash Meinel
Track down a few more files that have trailing whitespace. |
975 |
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
976 |
bug #5162
|
977 |
"""
|
|
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
978 |
wt = self.make_standard_commit('test-line-log', |
979 |
committer='Line-Log-Formatter Tester <test@line.log>', |
|
980 |
authors=[]) |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
981 |
self.assertFormatterResult(b"""\ |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
982 |
1: Line-Log-Formatte... 2005-11-22 add a
|
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
983 |
""", |
984 |
wt.branch, log.LineLogFormatter) |
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
985 |
|
986 |
def test_line_merge_revs_log_single_merge_revision(self): |
|
|
4955.4.19
by Vincent Ladeuil
Less code duplication. |
987 |
wt = self._prepare_tree_with_merges() |
|
3947.1.2
by Ian Clatworthy
formatter tests |
988 |
revspec = revisionspec.RevisionSpec.from_string('1.1.1') |
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
989 |
rev = revspec.in_history(wt.branch) |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
990 |
self.assertFormatterResult(b"""\ |
|
3947.1.2
by Ian Clatworthy
formatter tests |
991 |
1.1.1: Joe Foo 2005-11-22 rev-merged
|
992 |
""", |
|
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
993 |
wt.branch, log.LineLogFormatter, |
994 |
formatter_kwargs=dict(levels=0), |
|
995 |
show_log_kwargs=dict(start_revision=rev, end_revision=rev)) |
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
996 |
|
997 |
def test_line_merge_revs_log_with_merges(self): |
|
|
4955.4.19
by Vincent Ladeuil
Less code duplication. |
998 |
wt = self._prepare_tree_with_merges() |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
999 |
self.assertFormatterResult(b"""\ |
|
3983.2.1
by Neil Martinsen-Burrell
add merge indication to the line format |
1000 |
2: Joe Foo 2005-11-22 [merge] rev-2
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
1001 |
1.1.1: Joe Foo 2005-11-22 rev-merged
|
1002 |
1: Joe Foo 2005-11-22 rev-1
|
|
1003 |
""", |
|
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
1004 |
wt.branch, log.LineLogFormatter, |
1005 |
formatter_kwargs=dict(levels=0)) |
|
1006 |
||
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
1007 |
|
|
4081.2.4
by Martin von Gagern
Added basic test cases for GNU Changelog format. |
1008 |
class TestGnuChangelogFormatter(TestCaseForLogFormatter): |
1009 |
||
1010 |
def test_gnu_changelog(self): |
|
1011 |
wt = self.make_standard_commit('nicky', authors=[]) |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1012 |
self.assertFormatterResult(b'''\ |
|
4081.2.4
by Martin von Gagern
Added basic test cases for GNU Changelog format. |
1013 |
2005-11-22 Lorem Ipsum <test@example.com>
|
1014 |
||
1015 |
\tadd a |
|
1016 |
||
1017 |
''', |
|
1018 |
wt.branch, log.GnuChangelogLogFormatter) |
|
1019 |
||
1020 |
def test_with_authors(self): |
|
1021 |
wt = self.make_standard_commit('nicky', |
|
1022 |
authors=['Fooa Fooz <foo@example.com>', |
|
1023 |
'Bari Baro <bar@example.com>']) |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1024 |
self.assertFormatterResult(b'''\ |
|
4081.2.4
by Martin von Gagern
Added basic test cases for GNU Changelog format. |
1025 |
2005-11-22 Fooa Fooz <foo@example.com>
|
1026 |
||
1027 |
\tadd a |
|
1028 |
||
1029 |
''', |
|
1030 |
wt.branch, log.GnuChangelogLogFormatter) |
|
1031 |
||
1032 |
def test_verbose(self): |
|
1033 |
wt = self.make_standard_commit('nicky') |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1034 |
self.assertFormatterResult(b'''\ |
|
4081.2.4
by Martin von Gagern
Added basic test cases for GNU Changelog format. |
1035 |
2005-11-22 John Doe <jdoe@example.com>
|
1036 |
||
1037 |
\t* a: |
|
1038 |
||
1039 |
\tadd a |
|
1040 |
||
1041 |
''', |
|
1042 |
wt.branch, log.GnuChangelogLogFormatter, |
|
1043 |
show_log_kwargs=dict(verbose=True)) |
|
1044 |
||
|
1551.17.2
by Aaron Bentley
Stop showing deltas in pull -v output |
1045 |
|
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
1046 |
class TestShowChangedRevisions(tests.TestCaseWithTransport): |
|
1551.17.2
by Aaron Bentley
Stop showing deltas in pull -v output |
1047 |
|
1048 |
def test_show_changed_revisions_verbose(self): |
|
1049 |
tree = self.make_branch_and_tree('tree_a') |
|
1050 |
self.build_tree(['tree_a/foo']) |
|
1051 |
tree.add('foo') |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1052 |
tree.commit('bar', rev_id=b'bar-id') |
|
2717.1.1
by Lukáš Lalinsky
Use UTF-8 encoded StringIO for log tests to avoid failures on non-ASCII committer names. |
1053 |
s = self.make_utf8_encoded_stringio() |
|
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
1054 |
log.show_changed_revisions(tree.branch, [], [b'bar-id'], s) |
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1055 |
self.assertContainsRe(s.getvalue(), b'bar') |
1056 |
self.assertNotContainsRe(s.getvalue(), b'foo') |
|
|
2671.5.8
by Lukáš Lalinsky
Add tests for LogFormatter.short_committer and LogFormatter.short_author. |
1057 |
|
1058 |
||
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
1059 |
class TestLogFormatter(tests.TestCase): |
|
2671.5.8
by Lukáš Lalinsky
Add tests for LogFormatter.short_committer and LogFormatter.short_author. |
1060 |
|
|
4955.4.15
by Vincent Ladeuil
Remove duplicated code. |
1061 |
def setUp(self): |
1062 |
super(TestLogFormatter, self).setUp() |
|
|
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
1063 |
self.rev = revision.Revision(b'a-id') |
|
4955.4.15
by Vincent Ladeuil
Remove duplicated code. |
1064 |
self.lf = log.LogFormatter(None) |
1065 |
||
|
2671.5.8
by Lukáš Lalinsky
Add tests for LogFormatter.short_committer and LogFormatter.short_author. |
1066 |
def test_short_committer(self): |
|
4955.4.15
by Vincent Ladeuil
Remove duplicated code. |
1067 |
def assertCommitter(expected, committer): |
1068 |
self.rev.committer = committer |
|
1069 |
self.assertEqual(expected, self.lf.short_committer(self.rev)) |
|
1070 |
||
1071 |
assertCommitter('John Doe', 'John Doe <jdoe@example.com>') |
|
1072 |
assertCommitter('John Smith', 'John Smith <jsmith@example.com>') |
|
1073 |
assertCommitter('John Smith', 'John Smith') |
|
1074 |
assertCommitter('jsmith@example.com', 'jsmith@example.com') |
|
1075 |
assertCommitter('jsmith@example.com', '<jsmith@example.com>') |
|
1076 |
assertCommitter('John Smith', 'John Smith jsmith@example.com') |
|
|
2671.5.8
by Lukáš Lalinsky
Add tests for LogFormatter.short_committer and LogFormatter.short_author. |
1077 |
|
1078 |
def test_short_author(self): |
|
|
4955.4.15
by Vincent Ladeuil
Remove duplicated code. |
1079 |
def assertAuthor(expected, author): |
1080 |
self.rev.properties['author'] = author |
|
1081 |
self.assertEqual(expected, self.lf.short_author(self.rev)) |
|
1082 |
||
1083 |
assertAuthor('John Smith', 'John Smith <jsmith@example.com>') |
|
1084 |
assertAuthor('John Smith', 'John Smith') |
|
1085 |
assertAuthor('jsmith@example.com', 'jsmith@example.com') |
|
1086 |
assertAuthor('jsmith@example.com', '<jsmith@example.com>') |
|
1087 |
assertAuthor('John Smith', 'John Smith jsmith@example.com') |
|
1088 |
||
1089 |
def test_short_author_from_committer(self): |
|
1090 |
self.rev.committer = 'John Doe <jdoe@example.com>' |
|
1091 |
self.assertEqual('John Doe', self.lf.short_author(self.rev)) |
|
1092 |
||
1093 |
def test_short_author_from_authors(self): |
|
1094 |
self.rev.properties['authors'] = ('John Smith <jsmith@example.com>\n' |
|
1095 |
'Jane Rey <jrey@example.com>') |
|
1096 |
self.assertEqual('John Smith', self.lf.short_author(self.rev)) |
|
|
3842.2.2
by Vincent Ladeuil
Reproduce bug #300055. |
1097 |
|
1098 |
||
1099 |
class TestReverseByDepth(tests.TestCase): |
|
1100 |
"""Test reverse_by_depth behavior. |
|
1101 |
||
1102 |
This is used to present revisions in forward (oldest first) order in a nice
|
|
1103 |
layout.
|
|
1104 |
||
1105 |
The tests use lighter revision description to ease reading.
|
|
1106 |
"""
|
|
1107 |
||
1108 |
def assertReversed(self, forward, backward): |
|
1109 |
# Transform the descriptions to suit the API: tests use (revno, depth),
|
|
1110 |
# while the API expects (revid, revno, depth)
|
|
1111 |
def complete_revisions(l): |
|
1112 |
"""Transform the description to suit the API. |
|
1113 |
||
1114 |
Tests use (revno, depth) whil the API expects (revid, revno, depth).
|
|
1115 |
Since the revid is arbitrary, we just duplicate revno
|
|
1116 |
"""
|
|
1117 |
return [ (r, r, d) for r, d in l] |
|
1118 |
forward = complete_revisions(forward) |
|
1119 |
backward= complete_revisions(backward) |
|
1120 |
self.assertEqual(forward, log.reverse_by_depth(backward)) |
|
1121 |
||
1122 |
||
1123 |
def test_mainline_revisions(self): |
|
1124 |
self.assertReversed([( '1', 0), ('2', 0)], |
|
1125 |
[('2', 0), ('1', 0)]) |
|
1126 |
||
1127 |
def test_merged_revisions(self): |
|
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
1128 |
self.assertReversed([('1', 0), ('2', 0), ('2.2', 1), ('2.1', 1),], |
1129 |
[('2', 0), ('2.1', 1), ('2.2', 1), ('1', 0),]) |
|
|
3842.2.2
by Vincent Ladeuil
Reproduce bug #300055. |
1130 |
def test_shifted_merged_revisions(self): |
1131 |
"""Test irregular layout. |
|
1132 |
||
1133 |
Requesting revisions touching a file can produce "holes" in the depths.
|
|
1134 |
"""
|
|
1135 |
self.assertReversed([('1', 0), ('2', 0), ('1.1', 2), ('1.2', 2),], |
|
1136 |
[('2', 0), ('1.2', 2), ('1.1', 2), ('1', 0),]) |
|
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
1137 |
|
1138 |
def test_merged_without_child_revisions(self): |
|
1139 |
"""Test irregular layout. |
|
1140 |
||
1141 |
Revision ranges can produce "holes" in the depths.
|
|
1142 |
"""
|
|
1143 |
# When a revision of higher depth doesn't follow one of lower depth, we
|
|
1144 |
# assume a lower depth one is virtually there
|
|
1145 |
self.assertReversed([('1', 2), ('2', 2), ('3', 3), ('4', 4)], |
|
1146 |
[('4', 4), ('3', 3), ('2', 2), ('1', 2),]) |
|
1147 |
# So we get the same order after reversing below even if the original
|
|
1148 |
# revisions are not in the same order.
|
|
1149 |
self.assertReversed([('1', 2), ('2', 2), ('3', 3), ('4', 4)], |
|
1150 |
[('3', 3), ('4', 4), ('2', 2), ('1', 2),]) |
|
|
3848.1.6
by Aaron Bentley
Implement get_history_change |
1151 |
|
1152 |
||
|
3848.1.8
by Aaron Bentley
Implement basic show_branch_change |
1153 |
class TestHistoryChange(tests.TestCaseWithTransport): |
|
3848.1.6
by Aaron Bentley
Implement get_history_change |
1154 |
|
1155 |
def setup_a_tree(self): |
|
1156 |
tree = self.make_branch_and_tree('tree') |
|
1157 |
tree.lock_write() |
|
1158 |
self.addCleanup(tree.unlock) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1159 |
tree.commit('1a', rev_id=b'1a') |
1160 |
tree.commit('2a', rev_id=b'2a') |
|
1161 |
tree.commit('3a', rev_id=b'3a') |
|
|
3848.1.6
by Aaron Bentley
Implement get_history_change |
1162 |
return tree |
1163 |
||
1164 |
def setup_ab_tree(self): |
|
1165 |
tree = self.setup_a_tree() |
|
|
6973.10.6
by Jelmer Vernooij
Fix tests. |
1166 |
tree.set_last_revision(b'1a') |
1167 |
tree.branch.set_last_revision_info(1, b'1a') |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1168 |
tree.commit('2b', rev_id=b'2b') |
1169 |
tree.commit('3b', rev_id=b'3b') |
|
|
3848.1.6
by Aaron Bentley
Implement get_history_change |
1170 |
return tree |
1171 |
||
1172 |
def setup_ac_tree(self): |
|
1173 |
tree = self.setup_a_tree() |
|
1174 |
tree.set_last_revision(revision.NULL_REVISION) |
|
1175 |
tree.branch.set_last_revision_info(0, revision.NULL_REVISION) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1176 |
tree.commit('1c', rev_id=b'1c') |
1177 |
tree.commit('2c', rev_id=b'2c') |
|
1178 |
tree.commit('3c', rev_id=b'3c') |
|
|
3848.1.6
by Aaron Bentley
Implement get_history_change |
1179 |
return tree |
1180 |
||
1181 |
def test_all_new(self): |
|
1182 |
tree = self.setup_ab_tree() |
|
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1183 |
old, new = log.get_history_change(b'1a', b'3a', tree.branch.repository) |
|
3848.1.6
by Aaron Bentley
Implement get_history_change |
1184 |
self.assertEqual([], old) |
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1185 |
self.assertEqual([b'2a', b'3a'], new) |
|
3848.1.6
by Aaron Bentley
Implement get_history_change |
1186 |
|
1187 |
def test_all_old(self): |
|
1188 |
tree = self.setup_ab_tree() |
|
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1189 |
old, new = log.get_history_change(b'3a', b'1a', tree.branch.repository) |
|
3848.1.6
by Aaron Bentley
Implement get_history_change |
1190 |
self.assertEqual([], new) |
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1191 |
self.assertEqual([b'2a', b'3a'], old) |
|
3848.1.6
by Aaron Bentley
Implement get_history_change |
1192 |
|
1193 |
def test_null_old(self): |
|
1194 |
tree = self.setup_ab_tree() |
|
1195 |
old, new = log.get_history_change(revision.NULL_REVISION, |
|
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1196 |
b'3a', tree.branch.repository) |
|
3848.1.6
by Aaron Bentley
Implement get_history_change |
1197 |
self.assertEqual([], old) |
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1198 |
self.assertEqual([b'1a', b'2a', b'3a'], new) |
|
3848.1.6
by Aaron Bentley
Implement get_history_change |
1199 |
|
1200 |
def test_null_new(self): |
|
1201 |
tree = self.setup_ab_tree() |
|
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1202 |
old, new = log.get_history_change(b'3a', revision.NULL_REVISION, |
|
3848.1.7
by Aaron Bentley
Use repository in get_history_change |
1203 |
tree.branch.repository) |
|
3848.1.6
by Aaron Bentley
Implement get_history_change |
1204 |
self.assertEqual([], new) |
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1205 |
self.assertEqual([b'1a', b'2a', b'3a'], old) |
|
3848.1.6
by Aaron Bentley
Implement get_history_change |
1206 |
|
1207 |
def test_diverged(self): |
|
1208 |
tree = self.setup_ab_tree() |
|
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1209 |
old, new = log.get_history_change(b'3a', b'3b', tree.branch.repository) |
1210 |
self.assertEqual(old, [b'2a', b'3a']) |
|
1211 |
self.assertEqual(new, [b'2b', b'3b']) |
|
|
3848.1.6
by Aaron Bentley
Implement get_history_change |
1212 |
|
1213 |
def test_unrelated(self): |
|
1214 |
tree = self.setup_ac_tree() |
|
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1215 |
old, new = log.get_history_change(b'3a', b'3c', tree.branch.repository) |
1216 |
self.assertEqual(old, [b'1a', b'2a', b'3a']) |
|
1217 |
self.assertEqual(new, [b'1c', b'2c', b'3c']) |
|
|
3848.1.8
by Aaron Bentley
Implement basic show_branch_change |
1218 |
|
1219 |
def test_show_branch_change(self): |
|
1220 |
tree = self.setup_ab_tree() |
|
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1221 |
s = StringIO() |
1222 |
log.show_branch_change(tree.branch, s, 3, b'3a') |
|
|
3848.1.8
by Aaron Bentley
Implement basic show_branch_change |
1223 |
self.assertContainsRe(s.getvalue(), |
1224 |
'[*]{60}\nRemoved Revisions:\n(.|\n)*2a(.|\n)*3a(.|\n)*' |
|
1225 |
'[*]{60}\n\nAdded Revisions:\n(.|\n)*2b(.|\n)*3b') |
|
1226 |
||
1227 |
def test_show_branch_change_no_change(self): |
|
1228 |
tree = self.setup_ab_tree() |
|
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1229 |
s = StringIO() |
1230 |
log.show_branch_change(tree.branch, s, 3, b'3b') |
|
|
3848.1.8
by Aaron Bentley
Implement basic show_branch_change |
1231 |
self.assertEqual(s.getvalue(), |
1232 |
'Nothing seems to have changed\n') |
|
1233 |
||
|
3848.1.9
by Aaron Bentley
new/old sections are omitted as appropriate. |
1234 |
def test_show_branch_change_no_old(self): |
1235 |
tree = self.setup_ab_tree() |
|
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1236 |
s = StringIO() |
1237 |
log.show_branch_change(tree.branch, s, 2, b'2b') |
|
|
3848.1.9
by Aaron Bentley
new/old sections are omitted as appropriate. |
1238 |
self.assertContainsRe(s.getvalue(), 'Added Revisions:') |
1239 |
self.assertNotContainsRe(s.getvalue(), 'Removed Revisions:') |
|
1240 |
||
1241 |
def test_show_branch_change_no_new(self): |
|
1242 |
tree = self.setup_ab_tree() |
|
|
6973.10.6
by Jelmer Vernooij
Fix tests. |
1243 |
tree.branch.set_last_revision_info(2, b'2b') |
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1244 |
s = StringIO() |
1245 |
log.show_branch_change(tree.branch, s, 3, b'3b') |
|
|
3848.1.9
by Aaron Bentley
new/old sections are omitted as appropriate. |
1246 |
self.assertContainsRe(s.getvalue(), 'Removed Revisions:') |
1247 |
self.assertNotContainsRe(s.getvalue(), 'Added Revisions:') |
|
|
4921.2.1
by Neil Martinsen-Burrell
include bug fixes in log output |
1248 |
|
|
5728.5.2
by Matt Giuca
test_log: Split new test cases for this branch out into a separate class, |
1249 |
|
|
5728.5.4
by Matt Giuca
test_log: TestRevisionNotInBranch: Added three new test cases, testing the |
1250 |
class TestRevisionNotInBranch(TestCaseForLogFormatter): |
|
5728.5.2
by Matt Giuca
test_log: Split new test cases for this branch out into a separate class, |
1251 |
|
1252 |
def setup_a_tree(self): |
|
1253 |
tree = self.make_branch_and_tree('tree') |
|
1254 |
tree.lock_write() |
|
1255 |
self.addCleanup(tree.unlock) |
|
|
5728.5.3
by Matt Giuca
test_log: TestRevisionNotInBranch commits now have more metadata. |
1256 |
kwargs = { |
1257 |
'committer': 'Joe Foo <joe@foo.com>', |
|
1258 |
'timestamp': 1132617600, # Mon 2005-11-22 00:00:00 +0000 |
|
|
5728.5.10
by Andrew Bennetts
Use UTC, not system time zone, for the new log tests to get predictable output. |
1259 |
'timezone': 0, # UTC |
|
5728.5.3
by Matt Giuca
test_log: TestRevisionNotInBranch commits now have more metadata. |
1260 |
}
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1261 |
tree.commit('commit 1a', rev_id=b'1a', **kwargs) |
1262 |
tree.commit('commit 2a', rev_id=b'2a', **kwargs) |
|
1263 |
tree.commit('commit 3a', rev_id=b'3a', **kwargs) |
|
|
5728.5.2
by Matt Giuca
test_log: Split new test cases for this branch out into a separate class, |
1264 |
return tree |
1265 |
||
1266 |
def setup_ab_tree(self): |
|
1267 |
tree = self.setup_a_tree() |
|
|
6973.10.6
by Jelmer Vernooij
Fix tests. |
1268 |
tree.set_last_revision(b'1a') |
1269 |
tree.branch.set_last_revision_info(1, b'1a') |
|
|
5728.5.3
by Matt Giuca
test_log: TestRevisionNotInBranch commits now have more metadata. |
1270 |
kwargs = { |
1271 |
'committer': 'Joe Foo <joe@foo.com>', |
|
1272 |
'timestamp': 1132617600, # Mon 2005-11-22 00:00:00 +0000 |
|
|
5728.5.10
by Andrew Bennetts
Use UTC, not system time zone, for the new log tests to get predictable output. |
1273 |
'timezone': 0, # UTC |
|
5728.5.3
by Matt Giuca
test_log: TestRevisionNotInBranch commits now have more metadata. |
1274 |
}
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1275 |
tree.commit('commit 2b', rev_id=b'2b', **kwargs) |
1276 |
tree.commit('commit 3b', rev_id=b'3b', **kwargs) |
|
|
5728.5.2
by Matt Giuca
test_log: Split new test cases for this branch out into a separate class, |
1277 |
return tree |
1278 |
||
1279 |
def test_one_revision(self): |
|
|
5728.5.1
by Matt Giuca
log no longer raises NoSuchRevision against revisions in the |
1280 |
tree = self.setup_ab_tree() |
1281 |
lf = LogCatcher() |
|
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1282 |
rev = revisionspec.RevisionInfo(tree.branch, None, b'3a') |
|
5728.5.1
by Matt Giuca
log no longer raises NoSuchRevision against revisions in the |
1283 |
log.show_log(tree.branch, lf, verbose=True, start_revision=rev, |
1284 |
end_revision=rev) |
|
1285 |
self.assertEqual(1, len(lf.revisions)) |
|
|
5728.5.5
by Matt Giuca
log: If a revision is not in the branch, it now sets its revno to None |
1286 |
self.assertEqual(None, lf.revisions[0].revno) # Out-of-branch |
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1287 |
self.assertEqual(b'3a', lf.revisions[0].rev.revision_id) |
|
5728.5.1
by Matt Giuca
log no longer raises NoSuchRevision against revisions in the |
1288 |
|
|
5728.5.2
by Matt Giuca
test_log: Split new test cases for this branch out into a separate class, |
1289 |
def test_many_revisions(self): |
|
5728.5.1
by Matt Giuca
log no longer raises NoSuchRevision against revisions in the |
1290 |
tree = self.setup_ab_tree() |
1291 |
lf = LogCatcher() |
|
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1292 |
start_rev = revisionspec.RevisionInfo(tree.branch, None, b'1a') |
1293 |
end_rev = revisionspec.RevisionInfo(tree.branch, None, b'3a') |
|
|
5728.5.1
by Matt Giuca
log no longer raises NoSuchRevision against revisions in the |
1294 |
log.show_log(tree.branch, lf, verbose=True, start_revision=start_rev, |
1295 |
end_revision=end_rev) |
|
1296 |
self.assertEqual(3, len(lf.revisions)) |
|
|
5728.5.5
by Matt Giuca
log: If a revision is not in the branch, it now sets its revno to None |
1297 |
self.assertEqual(None, lf.revisions[0].revno) # Out-of-branch |
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1298 |
self.assertEqual(b'3a', lf.revisions[0].rev.revision_id) |
|
5728.5.5
by Matt Giuca
log: If a revision is not in the branch, it now sets its revno to None |
1299 |
self.assertEqual(None, lf.revisions[1].revno) # Out-of-branch |
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1300 |
self.assertEqual(b'2a', lf.revisions[1].rev.revision_id) |
|
5728.5.1
by Matt Giuca
log no longer raises NoSuchRevision against revisions in the |
1301 |
self.assertEqual('1', lf.revisions[2].revno) # In-branch |
|
4921.2.1
by Neil Martinsen-Burrell
include bug fixes in log output |
1302 |
|
|
5728.5.4
by Matt Giuca
test_log: TestRevisionNotInBranch: Added three new test cases, testing the |
1303 |
def test_long_format(self): |
1304 |
tree = self.setup_ab_tree() |
|
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1305 |
start_rev = revisionspec.RevisionInfo(tree.branch, None, b'1a') |
1306 |
end_rev = revisionspec.RevisionInfo(tree.branch, None, b'3a') |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1307 |
self.assertFormatterResult(b"""\ |
|
5728.5.4
by Matt Giuca
test_log: TestRevisionNotInBranch: Added three new test cases, testing the |
1308 |
------------------------------------------------------------
|
|
5728.5.6
by Matt Giuca
log: 'long' and 'short' log formats now always show the revision-id for any |
1309 |
revision-id: 3a
|
|
5728.5.4
by Matt Giuca
test_log: TestRevisionNotInBranch: Added three new test cases, testing the |
1310 |
committer: Joe Foo <joe@foo.com>
|
1311 |
branch nick: tree
|
|
|
5728.5.10
by Andrew Bennetts
Use UTC, not system time zone, for the new log tests to get predictable output. |
1312 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
5728.5.4
by Matt Giuca
test_log: TestRevisionNotInBranch: Added three new test cases, testing the |
1313 |
message:
|
1314 |
commit 3a
|
|
1315 |
------------------------------------------------------------
|
|
|
5728.5.6
by Matt Giuca
log: 'long' and 'short' log formats now always show the revision-id for any |
1316 |
revision-id: 2a
|
|
5728.5.4
by Matt Giuca
test_log: TestRevisionNotInBranch: Added three new test cases, testing the |
1317 |
committer: Joe Foo <joe@foo.com>
|
1318 |
branch nick: tree
|
|
|
5728.5.10
by Andrew Bennetts
Use UTC, not system time zone, for the new log tests to get predictable output. |
1319 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
5728.5.4
by Matt Giuca
test_log: TestRevisionNotInBranch: Added three new test cases, testing the |
1320 |
message:
|
1321 |
commit 2a
|
|
1322 |
------------------------------------------------------------
|
|
1323 |
revno: 1
|
|
1324 |
committer: Joe Foo <joe@foo.com>
|
|
1325 |
branch nick: tree
|
|
|
5728.5.10
by Andrew Bennetts
Use UTC, not system time zone, for the new log tests to get predictable output. |
1326 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
5728.5.4
by Matt Giuca
test_log: TestRevisionNotInBranch: Added three new test cases, testing the |
1327 |
message:
|
1328 |
commit 1a
|
|
1329 |
""", |
|
1330 |
tree.branch, log.LongLogFormatter, show_log_kwargs={ |
|
1331 |
'start_revision': start_rev, 'end_revision': end_rev |
|
1332 |
})
|
|
1333 |
||
1334 |
def test_short_format(self): |
|
1335 |
tree = self.setup_ab_tree() |
|
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1336 |
start_rev = revisionspec.RevisionInfo(tree.branch, None, b'1a') |
1337 |
end_rev = revisionspec.RevisionInfo(tree.branch, None, b'3a') |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1338 |
self.assertFormatterResult(b"""\ |
|
5728.5.5
by Matt Giuca
log: If a revision is not in the branch, it now sets its revno to None |
1339 |
Joe Foo\t2005-11-22 |
|
5728.5.6
by Matt Giuca
log: 'long' and 'short' log formats now always show the revision-id for any |
1340 |
revision-id:3a
|
|
5728.5.4
by Matt Giuca
test_log: TestRevisionNotInBranch: Added three new test cases, testing the |
1341 |
commit 3a
|
1342 |
||
|
5728.5.5
by Matt Giuca
log: If a revision is not in the branch, it now sets its revno to None |
1343 |
Joe Foo\t2005-11-22 |
|
5728.5.6
by Matt Giuca
log: 'long' and 'short' log formats now always show the revision-id for any |
1344 |
revision-id:2a
|
|
5728.5.4
by Matt Giuca
test_log: TestRevisionNotInBranch: Added three new test cases, testing the |
1345 |
commit 2a
|
1346 |
||
1347 |
1 Joe Foo\t2005-11-22 |
|
1348 |
commit 1a
|
|
1349 |
||
1350 |
""", |
|
1351 |
tree.branch, log.ShortLogFormatter, show_log_kwargs={ |
|
1352 |
'start_revision': start_rev, 'end_revision': end_rev |
|
1353 |
})
|
|
1354 |
||
1355 |
def test_line_format(self): |
|
1356 |
tree = self.setup_ab_tree() |
|
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1357 |
start_rev = revisionspec.RevisionInfo(tree.branch, None, b'1a') |
1358 |
end_rev = revisionspec.RevisionInfo(tree.branch, None, b'3a') |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1359 |
self.assertFormatterResult(b"""\ |
|
5728.5.5
by Matt Giuca
log: If a revision is not in the branch, it now sets its revno to None |
1360 |
Joe Foo 2005-11-22 commit 3a
|
1361 |
Joe Foo 2005-11-22 commit 2a
|
|
|
5728.5.4
by Matt Giuca
test_log: TestRevisionNotInBranch: Added three new test cases, testing the |
1362 |
1: Joe Foo 2005-11-22 commit 1a
|
1363 |
""", |
|
1364 |
tree.branch, log.LineLogFormatter, show_log_kwargs={ |
|
1365 |
'start_revision': start_rev, 'end_revision': end_rev |
|
1366 |
})
|
|
1367 |
||
|
4921.2.1
by Neil Martinsen-Burrell
include bug fixes in log output |
1368 |
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
1369 |
class TestLogWithBugs(TestCaseForLogFormatter, TestLogMixin): |
|
4921.2.1
by Neil Martinsen-Burrell
include bug fixes in log output |
1370 |
|
1371 |
def setUp(self): |
|
|
6552.1.4
by Vincent Ladeuil
Remaining tests matching setup(self) that can be rewritten with super(). |
1372 |
super(TestLogWithBugs, self).setUp() |
|
4921.2.1
by Neil Martinsen-Burrell
include bug fixes in log output |
1373 |
log.properties_handler_registry.register( |
1374 |
'bugs_properties_handler', |
|
1375 |
log._bugs_properties_handler) |
|
1376 |
||
|
4921.2.2
by Neil Martinsen-Burrell
from review comments: improve splitting, add test that handler is present, use build_tree in tests |
1377 |
def make_commits_with_bugs(self): |
1378 |
"""Helper method for LogFormatter tests""" |
|
1379 |
tree = self.make_branch_and_tree(u'.') |
|
1380 |
self.build_tree(['a', 'b']) |
|
1381 |
tree.add('a') |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1382 |
self.wt_commit(tree, 'simple log message', rev_id=b'a1', |
|
6973.12.5
by Jelmer Vernooij
Add some u's for revision property names. |
1383 |
revprops={u'bugs': 'test://bug/id fixed'}) |
|
4921.2.2
by Neil Martinsen-Burrell
from review comments: improve splitting, add test that handler is present, use build_tree in tests |
1384 |
tree.add('b') |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1385 |
self.wt_commit(tree, 'multiline\nlog\nmessage\n', rev_id=b'a2', |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
1386 |
authors=['Joe Bar <joe@bar.com>'], |
|
6973.12.5
by Jelmer Vernooij
Add some u's for revision property names. |
1387 |
revprops={u'bugs': 'test://bug/id fixed\n' |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
1388 |
'test://bug/2 fixed'}) |
|
4921.2.2
by Neil Martinsen-Burrell
from review comments: improve splitting, add test that handler is present, use build_tree in tests |
1389 |
return tree |
1390 |
||
1391 |
||
|
4921.2.1
by Neil Martinsen-Burrell
include bug fixes in log output |
1392 |
def test_long_bugs(self): |
|
4921.2.2
by Neil Martinsen-Burrell
from review comments: improve splitting, add test that handler is present, use build_tree in tests |
1393 |
tree = self.make_commits_with_bugs() |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1394 |
self.assertFormatterResult(b"""\ |
|
4921.2.1
by Neil Martinsen-Burrell
include bug fixes in log output |
1395 |
------------------------------------------------------------
|
1396 |
revno: 2
|
|
|
6143.1.8
by Jonathan Riddell
fix log formatting of bug line |
1397 |
fixes bugs: test://bug/id test://bug/2
|
|
4921.2.1
by Neil Martinsen-Burrell
include bug fixes in log output |
1398 |
author: Joe Bar <joe@bar.com>
|
1399 |
committer: Joe Foo <joe@foo.com>
|
|
1400 |
branch nick: work
|
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
1401 |
timestamp: Tue 2005-11-22 00:00:01 +0000
|
|
4921.2.1
by Neil Martinsen-Burrell
include bug fixes in log output |
1402 |
message:
|
1403 |
multiline
|
|
1404 |
log
|
|
1405 |
message
|
|
1406 |
------------------------------------------------------------
|
|
1407 |
revno: 1
|
|
|
6143.1.4
by Jonathan Riddell
update tests |
1408 |
fixes bug: test://bug/id
|
|
4921.2.1
by Neil Martinsen-Burrell
include bug fixes in log output |
1409 |
committer: Joe Foo <joe@foo.com>
|
1410 |
branch nick: work
|
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
1411 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
4921.2.1
by Neil Martinsen-Burrell
include bug fixes in log output |
1412 |
message:
|
1413 |
simple log message
|
|
1414 |
""", |
|
1415 |
tree.branch, log.LongLogFormatter) |
|
1416 |
||
1417 |
def test_short_bugs(self): |
|
|
4921.2.2
by Neil Martinsen-Burrell
from review comments: improve splitting, add test that handler is present, use build_tree in tests |
1418 |
tree = self.make_commits_with_bugs() |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1419 |
self.assertFormatterResult(b"""\ |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
1420 |
2 Joe Bar\t2005-11-22 |
|
6143.1.4
by Jonathan Riddell
update tests |
1421 |
fixes bugs: test://bug/id test://bug/2
|
|
4921.2.1
by Neil Martinsen-Burrell
include bug fixes in log output |
1422 |
multiline
|
1423 |
log
|
|
1424 |
message
|
|
1425 |
||
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
1426 |
1 Joe Foo\t2005-11-22 |
|
6143.1.4
by Jonathan Riddell
update tests |
1427 |
fixes bug: test://bug/id
|
|
4921.2.1
by Neil Martinsen-Burrell
include bug fixes in log output |
1428 |
simple log message
|
1429 |
||
1430 |
""", |
|
1431 |
tree.branch, log.ShortLogFormatter) |
|
1432 |
||
1433 |
def test_wrong_bugs_property(self): |
|
1434 |
tree = self.make_branch_and_tree(u'.') |
|
1435 |
self.build_tree(['foo']) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1436 |
self.wt_commit(tree, 'simple log message', rev_id=b'a1', |
|
6973.12.5
by Jelmer Vernooij
Add some u's for revision property names. |
1437 |
revprops={u'bugs': 'test://bug/id invalid_value'}) |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1438 |
self.assertFormatterResult(b"""\ |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
1439 |
1 Joe Foo\t2005-11-22 |
|
4921.2.1
by Neil Martinsen-Burrell
include bug fixes in log output |
1440 |
simple log message
|
1441 |
||
1442 |
""", |
|
1443 |
tree.branch, log.ShortLogFormatter) |
|
|
4921.2.2
by Neil Martinsen-Burrell
from review comments: improve splitting, add test that handler is present, use build_tree in tests |
1444 |
|
1445 |
def test_bugs_handler_present(self): |
|
1446 |
self.properties_handler_registry.get('bugs_properties_handler') |
|
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1447 |
|
1448 |
||
1449 |
class TestLogForAuthors(TestCaseForLogFormatter): |
|
1450 |
||
1451 |
def setUp(self): |
|
|
6552.1.4
by Vincent Ladeuil
Remaining tests matching setup(self) that can be rewritten with super(). |
1452 |
super(TestLogForAuthors, self).setUp() |
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1453 |
self.wt = self.make_standard_commit('nicky', |
1454 |
authors=['John Doe <jdoe@example.com>', |
|
1455 |
'Jane Rey <jrey@example.com>']) |
|
1456 |
||
1457 |
def assertFormatterResult(self, formatter, who, result): |
|
1458 |
formatter_kwargs = dict() |
|
1459 |
if who is not None: |
|
|
4081.3.10
by Martin von Gagern
Renamed "authors" to "author_list_handler" in several places. |
1460 |
author_list_handler = log.author_list_registry.get(who) |
1461 |
formatter_kwargs['author_list_handler'] = author_list_handler |
|
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1462 |
TestCaseForLogFormatter.assertFormatterResult(self, result, |
1463 |
self.wt.branch, formatter, formatter_kwargs=formatter_kwargs) |
|
1464 |
||
1465 |
def test_line_default(self): |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1466 |
self.assertFormatterResult(log.LineLogFormatter, None, b"""\ |
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1467 |
1: John Doe 2005-11-22 add a
|
1468 |
""") |
|
1469 |
||
1470 |
def test_line_committer(self): |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1471 |
self.assertFormatterResult(log.LineLogFormatter, 'committer', b"""\ |
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1472 |
1: Lorem Ipsum 2005-11-22 add a
|
1473 |
""") |
|
1474 |
||
1475 |
def test_line_first(self): |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1476 |
self.assertFormatterResult(log.LineLogFormatter, 'first', b"""\ |
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1477 |
1: John Doe 2005-11-22 add a
|
1478 |
""") |
|
1479 |
||
1480 |
def test_line_all(self): |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1481 |
self.assertFormatterResult(log.LineLogFormatter, 'all', b"""\ |
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1482 |
1: John Doe, Jane Rey 2005-11-22 add a
|
1483 |
""") |
|
1484 |
||
1485 |
||
1486 |
def test_short_default(self): |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1487 |
self.assertFormatterResult(log.ShortLogFormatter, None, b"""\ |
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1488 |
1 John Doe\t2005-11-22 |
1489 |
add a
|
|
1490 |
||
1491 |
""") |
|
1492 |
||
1493 |
def test_short_committer(self): |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1494 |
self.assertFormatterResult(log.ShortLogFormatter, 'committer', b"""\ |
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1495 |
1 Lorem Ipsum\t2005-11-22 |
1496 |
add a
|
|
1497 |
||
1498 |
""") |
|
1499 |
||
1500 |
def test_short_first(self): |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1501 |
self.assertFormatterResult(log.ShortLogFormatter, 'first', b"""\ |
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1502 |
1 John Doe\t2005-11-22 |
1503 |
add a
|
|
1504 |
||
1505 |
""") |
|
1506 |
||
1507 |
def test_short_all(self): |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1508 |
self.assertFormatterResult(log.ShortLogFormatter, 'all', b"""\ |
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1509 |
1 John Doe, Jane Rey\t2005-11-22 |
1510 |
add a
|
|
1511 |
||
1512 |
""") |
|
1513 |
||
1514 |
def test_long_default(self): |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1515 |
self.assertFormatterResult(log.LongLogFormatter, None, b"""\ |
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1516 |
------------------------------------------------------------
|
1517 |
revno: 1
|
|
1518 |
author: John Doe <jdoe@example.com>, Jane Rey <jrey@example.com>
|
|
1519 |
committer: Lorem Ipsum <test@example.com>
|
|
1520 |
branch nick: nicky
|
|
1521 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
1522 |
message:
|
|
1523 |
add a
|
|
1524 |
""") |
|
1525 |
||
1526 |
def test_long_committer(self): |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1527 |
self.assertFormatterResult(log.LongLogFormatter, 'committer', b"""\ |
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1528 |
------------------------------------------------------------
|
1529 |
revno: 1
|
|
1530 |
committer: Lorem Ipsum <test@example.com>
|
|
1531 |
branch nick: nicky
|
|
1532 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
1533 |
message:
|
|
1534 |
add a
|
|
1535 |
""") |
|
1536 |
||
1537 |
def test_long_first(self): |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1538 |
self.assertFormatterResult(log.LongLogFormatter, 'first', b"""\ |
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1539 |
------------------------------------------------------------
|
1540 |
revno: 1
|
|
1541 |
author: John Doe <jdoe@example.com>
|
|
1542 |
committer: Lorem Ipsum <test@example.com>
|
|
1543 |
branch nick: nicky
|
|
1544 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
1545 |
message:
|
|
1546 |
add a
|
|
1547 |
""") |
|
1548 |
||
1549 |
def test_long_all(self): |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1550 |
self.assertFormatterResult(log.LongLogFormatter, 'all', b"""\ |
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1551 |
------------------------------------------------------------
|
1552 |
revno: 1
|
|
1553 |
author: John Doe <jdoe@example.com>, Jane Rey <jrey@example.com>
|
|
1554 |
committer: Lorem Ipsum <test@example.com>
|
|
1555 |
branch nick: nicky
|
|
1556 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
1557 |
message:
|
|
1558 |
add a
|
|
1559 |
""") |
|
1560 |
||
1561 |
def test_gnu_changelog_default(self): |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1562 |
self.assertFormatterResult(log.GnuChangelogLogFormatter, None, b"""\ |
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1563 |
2005-11-22 John Doe <jdoe@example.com>
|
1564 |
||
1565 |
\tadd a |
|
1566 |
||
1567 |
""") |
|
1568 |
||
1569 |
def test_gnu_changelog_committer(self): |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1570 |
self.assertFormatterResult(log.GnuChangelogLogFormatter, 'committer', b"""\ |
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1571 |
2005-11-22 Lorem Ipsum <test@example.com>
|
1572 |
||
1573 |
\tadd a |
|
1574 |
||
1575 |
""") |
|
1576 |
||
1577 |
def test_gnu_changelog_first(self): |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1578 |
self.assertFormatterResult(log.GnuChangelogLogFormatter, 'first', b"""\ |
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1579 |
2005-11-22 John Doe <jdoe@example.com>
|
1580 |
||
1581 |
\tadd a |
|
1582 |
||
1583 |
""") |
|
1584 |
||
1585 |
def test_gnu_changelog_all(self): |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1586 |
self.assertFormatterResult(log.GnuChangelogLogFormatter, 'all', b"""\ |
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1587 |
2005-11-22 John Doe <jdoe@example.com>, Jane Rey <jrey@example.com>
|
1588 |
||
1589 |
\tadd a |
|
1590 |
||
1591 |
""") |
|
|
4081.3.15
by Gary van der Merwe
Merge bzr.dev. |
1592 |
|
|
5691.1.3
by Jelmer Vernooij
Fix whitespace. |
1593 |
|
|
5097.1.12
by Vincent Ladeuil
Implement the --exclude-common-ancestry log option. |
1594 |
class TestLogExcludeAncestry(tests.TestCaseWithTransport): |
1595 |
||
1596 |
def make_branch_with_alternate_ancestries(self, relpath='.'): |
|
|
5155.1.5
by Vincent Ladeuil
Fixed as per Andrew's review. |
1597 |
# See test_merge_sorted_exclude_ancestry below for the difference with
|
1598 |
# bt.per_branch.test_iter_merge_sorted_revision.
|
|
|
6042.1.1
by Thomi Richards
Fix bug #747958 - 'levels' value is no longer overridden in Logger if the user explicitly asked for less details than the logger is capable of providing. |
1599 |
# TestIterMergeSortedRevisionsBushyGraph.
|
|
5155.1.5
by Vincent Ladeuil
Fixed as per Andrew's review. |
1600 |
# make_branch_with_alternate_ancestries
|
1601 |
# and test_merge_sorted_exclude_ancestry
|
|
1602 |
# See the FIXME in assertLogRevnos too.
|
|
|
5097.1.12
by Vincent Ladeuil
Implement the --exclude-common-ancestry log option. |
1603 |
builder = branchbuilder.BranchBuilder(self.get_transport(relpath)) |
1604 |
# 1
|
|
1605 |
# |\
|
|
|
5155.1.3
by Vincent Ladeuil
Fix the performance by finding the relevant subgraph once. |
1606 |
# 2 \
|
1607 |
# | |
|
|
1608 |
# | 1.1.1
|
|
1609 |
# | | \
|
|
|
5097.1.12
by Vincent Ladeuil
Implement the --exclude-common-ancestry log option. |
1610 |
# | | 1.2.1
|
1611 |
# | | /
|
|
1612 |
# | 1.1.2
|
|
1613 |
# | /
|
|
1614 |
# 3
|
|
1615 |
builder.start_series() |
|
|
6816.2.1
by Jelmer Vernooij
Migrate some build_snapshot code over to having revision_id as keyword argument. |
1616 |
builder.build_snapshot(None, [ |
|
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
1617 |
('add', ('', b'TREE_ROOT', 'directory', '')),], |
|
6973.5.2
by Jelmer Vernooij
Add more bees. |
1618 |
revision_id=b'1') |
|
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
1619 |
builder.build_snapshot([b'1'], [], revision_id=b'1.1.1') |
1620 |
builder.build_snapshot([b'1'], [], revision_id=b'2') |
|
1621 |
builder.build_snapshot([b'1.1.1'], [], revision_id=b'1.2.1') |
|
1622 |
builder.build_snapshot([b'1.1.1', b'1.2.1'], [], revision_id=b'1.1.2') |
|
1623 |
builder.build_snapshot([b'2', b'1.1.2'], [], revision_id=b'3') |
|
|
5097.1.12
by Vincent Ladeuil
Implement the --exclude-common-ancestry log option. |
1624 |
builder.finish_series() |
1625 |
br = builder.get_branch() |
|
1626 |
br.lock_read() |
|
1627 |
self.addCleanup(br.unlock) |
|
1628 |
return br |
|
1629 |
||
1630 |
def assertLogRevnos(self, expected_revnos, b, start, end, |
|
|
5268.4.2
by Vincent Ladeuil
Failing whitebox test for bug #575631. |
1631 |
exclude_common_ancestry, generate_merge_revisions=True): |
|
5097.1.12
by Vincent Ladeuil
Implement the --exclude-common-ancestry log option. |
1632 |
# FIXME: the layering in log makes it hard to test intermediate levels,
|
|
6376.1.1
by Vincent Ladeuil
Relax constraints on bzr log -rX..Y by falling back to the slower implementation when needed |
1633 |
# I wish adding filters with their parameters was easier...
|
|
5097.1.12
by Vincent Ladeuil
Implement the --exclude-common-ancestry log option. |
1634 |
# -- vila 20100413
|
1635 |
iter_revs = log._calc_view_revisions( |
|
1636 |
b, start, end, direction='reverse', |
|
|
5268.4.2
by Vincent Ladeuil
Failing whitebox test for bug #575631. |
1637 |
generate_merge_revisions=generate_merge_revisions, |
|
5097.1.12
by Vincent Ladeuil
Implement the --exclude-common-ancestry log option. |
1638 |
exclude_common_ancestry=exclude_common_ancestry) |
1639 |
self.assertEqual(expected_revnos, |
|
1640 |
[revid for revid, revno, depth in iter_revs]) |
|
1641 |
||
1642 |
def test_merge_sorted_exclude_ancestry(self): |
|
1643 |
b = self.make_branch_with_alternate_ancestries() |
|
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1644 |
self.assertLogRevnos([b'3', b'1.1.2', b'1.2.1', b'1.1.1', b'2', b'1'], |
1645 |
b, b'1', b'3', exclude_common_ancestry=False) |
|
|
5155.1.5
by Vincent Ladeuil
Fixed as per Andrew's review. |
1646 |
# '2' is part of the '3' ancestry but not part of '1.1.1' ancestry so
|
1647 |
# it should be mentioned even if merge_sort order will make it appear
|
|
1648 |
# after 1.1.1
|
|
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1649 |
self.assertLogRevnos([b'3', b'1.1.2', b'1.2.1', b'2'], |
1650 |
b, b'1.1.1', b'3', exclude_common_ancestry=True) |
|
|
5097.1.12
by Vincent Ladeuil
Implement the --exclude-common-ancestry log option. |
1651 |
|
|
5268.4.2
by Vincent Ladeuil
Failing whitebox test for bug #575631. |
1652 |
def test_merge_sorted_simple_revnos_exclude_ancestry(self): |
1653 |
b = self.make_branch_with_alternate_ancestries() |
|
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1654 |
self.assertLogRevnos([b'3', b'2'], |
1655 |
b, b'1', b'3', exclude_common_ancestry=True, |
|
|
5268.4.2
by Vincent Ladeuil
Failing whitebox test for bug #575631. |
1656 |
generate_merge_revisions=False) |
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1657 |
self.assertLogRevnos([b'3', b'1.1.2', b'1.2.1', b'1.1.1', b'2'], |
1658 |
b, b'1', b'3', exclude_common_ancestry=True, |
|
|
5268.4.3
by Vincent Ladeuil
Respect --exclude-common-ancestry for linear ancestries. |
1659 |
generate_merge_revisions=True) |
|
5097.1.12
by Vincent Ladeuil
Implement the --exclude-common-ancestry log option. |
1660 |
|
|
6042.1.1
by Thomi Richards
Fix bug #747958 - 'levels' value is no longer overridden in Logger if the user explicitly asked for less details than the logger is capable of providing. |
1661 |
|
1662 |
class TestLogDefaults(TestCaseForLogFormatter): |
|
1663 |
def test_default_log_level(self): |
|
|
6042.1.2
by Thomi Richards
Minor changes as a result of feedback from merge proposal. |
1664 |
""" |
1665 |
Test to ensure that specifying 'levels=1' to make_log_request_dict
|
|
1666 |
doesn't get overwritten when using a LogFormatter that supports more
|
|
1667 |
detail.
|
|
1668 |
Fixes bug #747958.
|
|
1669 |
"""
|
|
|
6042.1.1
by Thomi Richards
Fix bug #747958 - 'levels' value is no longer overridden in Logger if the user explicitly asked for less details than the logger is capable of providing. |
1670 |
wt = self._prepare_tree_with_merges() |
1671 |
b = wt.branch |
|
1672 |
||
1673 |
class CustomLogFormatter(log.LogFormatter): |
|
1674 |
def __init__(self, *args, **kwargs): |
|
1675 |
super(CustomLogFormatter, self).__init__(*args, **kwargs) |
|
1676 |
self.revisions = [] |
|
1677 |
def get_levels(self): |
|
1678 |
# log formatter supports all levels:
|
|
1679 |
return 0 |
|
1680 |
def log_revision(self, revision): |
|
1681 |
self.revisions.append(revision) |
|
1682 |
||
1683 |
log_formatter = LogCatcher() |
|
1684 |
# First request we don't specify number of levels, we should get a
|
|
1685 |
# sensible default (whatever the LogFormatter handles - which in this
|
|
1686 |
# case is 0/everything):
|
|
1687 |
request = log.make_log_request_dict(limit=10) |
|
1688 |
log.Logger(b, request).show(log_formatter) |
|
1689 |
# should have all three revisions:
|
|
|
6614.1.3
by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual. |
1690 |
self.assertEqual(len(log_formatter.revisions), 3) |
|
6042.1.1
by Thomi Richards
Fix bug #747958 - 'levels' value is no longer overridden in Logger if the user explicitly asked for less details than the logger is capable of providing. |
1691 |
|
1692 |
del log_formatter |
|
1693 |
log_formatter = LogCatcher() |
|
1694 |
# now explicitly request mainline revisions only:
|
|
1695 |
request = log.make_log_request_dict(limit=10, levels=1) |
|
1696 |
log.Logger(b, request).show(log_formatter) |
|
1697 |
# should now only have 2 revisions:
|
|
|
6614.1.3
by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual. |
1698 |
self.assertEqual(len(log_formatter.revisions), 2) |
|
6283.1.13
by Jelmer Vernooij
ADd hpss call count tests for 'bzr log'. |
1699 |