bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
2359.1.6
by John Arbash Meinel
Create a helper tree which has a semi-interesting history. |
1 |
# Copyright (C) 2005, 2006, 2007 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 |
|
|
1123
by Martin Pool
* move bzr-specific code from testsweet into bzrlib.selftest |
18 |
from cStringIO import StringIO |
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
19 |
|
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
20 |
from bzrlib import ( |
21 |
errors, |
|
22 |
log, |
|
23 |
registry, |
|
24 |
revision, |
|
25 |
revisionspec, |
|
26 |
tests, |
|
27 |
)
|
|
28 |
||
29 |
||
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
30 |
class TestCaseForLogFormatter(tests.TestCaseWithTransport): |
|
3144.7.9
by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors |
31 |
|
32 |
def setUp(self): |
|
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
33 |
super(TestCaseForLogFormatter, self).setUp() |
|
3144.7.9
by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors |
34 |
# 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. |
35 |
self.properties_handler_registry = log.properties_handler_registry |
|
4325.4.3
by Vincent Ladeuil
More cleanups. |
36 |
# Use a clean registry for log
|
|
3144.7.9
by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors |
37 |
log.properties_handler_registry = registry.Registry() |
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
38 |
|
|
4325.4.3
by Vincent Ladeuil
More cleanups. |
39 |
def restore(): |
40 |
log.properties_handler_registry = self.properties_handler_registry |
|
41 |
self.addCleanup(restore) |
|
|
3144.7.9
by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors |
42 |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
43 |
def assertFormatterResult(self, result, branch, formatter_class, |
44 |
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, |
45 |
normalize=False): |
46 |
logfile = self.make_utf8_encoded_stringio() |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
47 |
if formatter_kwargs is None: |
48 |
formatter_kwargs = {} |
|
49 |
formatter = formatter_class(to_file=logfile, **formatter_kwargs) |
|
50 |
if show_log_kwargs is None: |
|
51 |
show_log_kwargs = {} |
|
52 |
log.show_log(branch, formatter, **show_log_kwargs) |
|
53 |
log_content = logfile.getvalue() |
|
54 |
if normalize: |
|
55 |
log_content = normalize_log(log_content) |
|
56 |
self.assertEqualDiff(result, log_content) |
|
57 |
||
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
58 |
def make_standard_commit(self, branch_nick, **kwargs): |
59 |
wt = self.make_branch_and_tree('.') |
|
60 |
wt.lock_write() |
|
61 |
self.addCleanup(wt.unlock) |
|
62 |
self.build_tree(['a']) |
|
63 |
wt.add(['a']) |
|
64 |
wt.branch.nick = branch_nick |
|
65 |
kwargs = dict(kwargs) |
|
66 |
kwargs.setdefault('message', 'add a') |
|
67 |
kwargs.setdefault('timestamp', 1132711707) |
|
68 |
kwargs.setdefault('timezone', 36000) |
|
69 |
kwargs.setdefault('committer', 'Lorem Ipsum <test@example.com>') |
|
70 |
kwargs.setdefault('authors', ['John Doe <jdoe@example.com>']) |
|
71 |
wt.commit(**kwargs) |
|
72 |
return wt |
|
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
73 |
|
|
4955.4.1
by Vincent Ladeuil
Refactor the function into an helper. |
74 |
def make_commits_with_trailing_newlines(self, wt): |
75 |
"""Helper method for LogFormatter tests""" |
|
76 |
b = wt.branch |
|
77 |
b.nick = 'test' |
|
78 |
open('a', 'wb').write('hello moto\n') |
|
79 |
wt.add('a') |
|
80 |
wt.commit('simple log message', rev_id='a1', |
|
81 |
timestamp=1132586655.459960938, timezone=-6*3600, |
|
82 |
committer='Joe Foo <joe@foo.com>') |
|
83 |
open('b', 'wb').write('goodbye\n') |
|
84 |
wt.add('b') |
|
85 |
wt.commit('multiline\nlog\nmessage\n', rev_id='a2', |
|
86 |
timestamp=1132586842.411175966, timezone=-6*3600, |
|
87 |
committer='Joe Foo <joe@foo.com>', |
|
88 |
authors=['Joe Bar <joe@bar.com>']) |
|
89 |
||
90 |
open('c', 'wb').write('just another manic monday\n') |
|
91 |
wt.add('c') |
|
92 |
wt.commit('single line with trailing newline\n', rev_id='a3', |
|
93 |
timestamp=1132587176.835228920, timezone=-6*3600, |
|
94 |
committer = 'Joe Foo <joe@foo.com>') |
|
95 |
return b |
|
96 |
||
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
97 |
def _prepare_tree_with_merges(self, with_tags=False): |
98 |
wt = self.make_branch_and_memory_tree('.') |
|
99 |
wt.lock_write() |
|
100 |
self.addCleanup(wt.unlock) |
|
101 |
wt.add('') |
|
102 |
wt.commit('rev-1', rev_id='rev-1', |
|
103 |
timestamp=1132586655, timezone=36000, |
|
104 |
committer='Joe Foo <joe@foo.com>') |
|
105 |
wt.commit('rev-merged', rev_id='rev-2a', |
|
106 |
timestamp=1132586700, timezone=36000, |
|
107 |
committer='Joe Foo <joe@foo.com>') |
|
108 |
wt.set_parent_ids(['rev-1', 'rev-2a']) |
|
109 |
wt.branch.set_last_revision_info(1, 'rev-1') |
|
110 |
wt.commit('rev-2', rev_id='rev-2b', |
|
111 |
timestamp=1132586800, timezone=36000, |
|
112 |
committer='Joe Foo <joe@foo.com>') |
|
113 |
if with_tags: |
|
114 |
branch = wt.branch |
|
115 |
branch.tags.set_tag('v0.2', 'rev-2b') |
|
116 |
wt.commit('rev-3', rev_id='rev-3', |
|
117 |
timestamp=1132586900, timezone=36000, |
|
118 |
committer='Jane Foo <jane@foo.com>') |
|
119 |
branch.tags.set_tag('v1.0rc1', 'rev-3') |
|
120 |
branch.tags.set_tag('v1.0', 'rev-3') |
|
121 |
return wt |
|
122 |
||
|
3144.7.9
by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors |
123 |
|
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
124 |
class LogCatcher(log.LogFormatter): |
|
4325.4.3
by Vincent Ladeuil
More cleanups. |
125 |
"""Pull log messages into a list rather than displaying them. |
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
126 |
|
|
4325.4.3
by Vincent Ladeuil
More cleanups. |
127 |
To simplify testing we save logged revisions here rather than actually
|
|
4325.4.1
by Vincent Ladeuil
Some cleanups. |
128 |
formatting anything, so that we can precisely check the result without
|
|
4325.4.3
by Vincent Ladeuil
More cleanups. |
129 |
being dependent on the formatting.
|
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
130 |
"""
|
|
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. |
131 |
|
|
2490.1.2
by John Arbash Meinel
Cleanup according to PEP8 and some other small whitespace fixes |
132 |
supports_delta = True |
|
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 |
|
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
134 |
def __init__(self): |
135 |
super(LogCatcher, self).__init__(to_file=None) |
|
|
4325.4.4
by Vincent Ladeuil
Clarify LogCatcher purpose. |
136 |
self.revisions = [] |
|
1704.2.20
by Martin Pool
log --line shows revision numbers (Alexander) |
137 |
|
|
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 |
def log_revision(self, revision): |
|
4325.4.4
by Vincent Ladeuil
Clarify LogCatcher purpose. |
139 |
self.revisions.append(revision) |
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
140 |
|
141 |
||
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
142 |
class TestShowLog(tests.TestCaseWithTransport): |
|
1102
by Martin Pool
- merge test refactoring from robertc |
143 |
|
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
144 |
def checkDelta(self, delta, **kw): |
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
145 |
"""Check the filenames touched by a delta are as expected. |
146 |
||
147 |
Caller only have to pass in the list of files for each part, all
|
|
148 |
unspecified parts are considered empty (and checked as such).
|
|
149 |
"""
|
|
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
150 |
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. |
151 |
# By default we expect an empty list
|
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
152 |
expected = kw.get(n, []) |
153 |
# strip out only the path components
|
|
154 |
got = [x[0] for x in getattr(delta, n)] |
|
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
155 |
self.assertEqual(expected, got) |
156 |
||
157 |
def assertInvalidRevisonNumber(self, br, start, end): |
|
158 |
lf = LogCatcher() |
|
159 |
self.assertRaises(errors.InvalidRevisionNumber, |
|
160 |
log.show_log, br, lf, |
|
161 |
start_revision=start, end_revision=end) |
|
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
162 |
|
|
974.1.54
by aaron.bentley at utoronto
Fixed the revno bug in log |
163 |
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. |
164 |
wt = self.make_branch_and_tree('.') |
165 |
b = wt.branch |
|
|
1092.3.4
by Robert Collins
update symlink branch to integration |
166 |
|
167 |
lf = LogCatcher() |
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
168 |
wt.commit('empty commit') |
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
169 |
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. |
170 |
|
171 |
# Since there is a single revision in the branch all the combinations
|
|
172 |
# below should fail.
|
|
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
173 |
self.assertInvalidRevisonNumber(b, 2, 1) |
174 |
self.assertInvalidRevisonNumber(b, 1, 2) |
|
175 |
self.assertInvalidRevisonNumber(b, 0, 2) |
|
176 |
self.assertInvalidRevisonNumber(b, 1, 0) |
|
177 |
self.assertInvalidRevisonNumber(b, -1, 1) |
|
178 |
self.assertInvalidRevisonNumber(b, 1, -1) |
|
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
179 |
|
180 |
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. |
181 |
wt = self.make_branch_and_tree('.') |
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
182 |
|
183 |
lf = LogCatcher() |
|
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
184 |
log.show_log(wt.branch, lf) |
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
185 |
# no entries yet
|
|
4325.4.4
by Vincent Ladeuil
Clarify LogCatcher purpose. |
186 |
self.assertEqual([], lf.revisions) |
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
187 |
|
188 |
def test_empty_commit(self): |
|
189 |
wt = self.make_branch_and_tree('.') |
|
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
190 |
|
|
1534.4.36
by Robert Collins
Finish deprecating Branch.working_tree() |
191 |
wt.commit('empty commit') |
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
192 |
lf = LogCatcher() |
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
193 |
log.show_log(wt.branch, lf, verbose=True) |
|
4325.4.4
by Vincent Ladeuil
Clarify LogCatcher purpose. |
194 |
revs = lf.revisions |
195 |
self.assertEqual(1, len(revs)) |
|
196 |
self.assertEqual('1', revs[0].revno) |
|
197 |
self.assertEqual('empty commit', revs[0].rev.message) |
|
198 |
self.checkDelta(revs[0].delta) |
|
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
199 |
|
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
200 |
def test_simple_commit(self): |
201 |
wt = self.make_branch_and_tree('.') |
|
202 |
wt.commit('empty commit') |
|
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
203 |
self.build_tree(['hello']) |
|
1534.4.36
by Robert Collins
Finish deprecating Branch.working_tree() |
204 |
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. |
205 |
wt.commit('add one file', |
206 |
committer=u'\u013d\xf3r\xe9m \xcdp\u0161\xfam ' |
|
207 |
u'<test@example.com>') |
|
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
208 |
lf = LogCatcher() |
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
209 |
log.show_log(wt.branch, lf, verbose=True) |
|
4325.4.4
by Vincent Ladeuil
Clarify LogCatcher purpose. |
210 |
self.assertEqual(2, len(lf.revisions)) |
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
211 |
# first one is most recent
|
|
4325.4.4
by Vincent Ladeuil
Clarify LogCatcher purpose. |
212 |
log_entry = lf.revisions[0] |
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
213 |
self.assertEqual('2', log_entry.revno) |
214 |
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. |
215 |
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. |
216 |
|
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
217 |
def test_commit_message_with_control_chars(self): |
218 |
wt = self.make_branch_and_tree('.') |
|
|
3831.1.6
by John Arbash Meinel
For the simple-log tests, avoid using '\r' in the test. |
219 |
msg = u"All 8-bit chars: " + ''.join([unichr(x) for x in range(256)]) |
220 |
msg = msg.replace(u'\r', u'\n') |
|
|
1534.4.36
by Robert Collins
Finish deprecating Branch.working_tree() |
221 |
wt.commit(msg) |
|
1185.11.5
by John Arbash Meinel
Merged up-to-date against mainline, still broken. |
222 |
lf = LogCatcher() |
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
223 |
log.show_log(wt.branch, lf, verbose=True) |
|
4325.4.4
by Vincent Ladeuil
Clarify LogCatcher purpose. |
224 |
committed_msg = lf.revisions[0].rev.message |
|
4627.1.1
by Robert Collins
Review feedback per IanC. |
225 |
if wt.branch.repository._serializer.squashes_xml_invalid_characters: |
226 |
self.assertNotEqual(msg, committed_msg) |
|
227 |
self.assertTrue(len(committed_msg) > len(msg)) |
|
228 |
else: |
|
229 |
self.assertEqual(msg, committed_msg) |
|
|
1393.4.2
by Harald Meland
Cleanup + better test of commit-msg control character escape code. |
230 |
|
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
231 |
def test_commit_message_without_control_chars(self): |
232 |
wt = self.make_branch_and_tree('.') |
|
|
1393.4.2
by Harald Meland
Cleanup + better test of commit-msg control character escape code. |
233 |
# escaped. As ElementTree apparently does some kind of
|
234 |
# newline conversion, neither LF (\x0A) nor CR (\x0D) are
|
|
235 |
# included in the test commit message, even though they are
|
|
236 |
# valid XML 1.0 characters.
|
|
237 |
msg = "\x09" + ''.join([unichr(x) for x in range(0x20, 256)]) |
|
|
1534.4.36
by Robert Collins
Finish deprecating Branch.working_tree() |
238 |
wt.commit(msg) |
|
1393.4.2
by Harald Meland
Cleanup + better test of commit-msg control character escape code. |
239 |
lf = LogCatcher() |
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
240 |
log.show_log(wt.branch, lf, verbose=True) |
|
4325.4.4
by Vincent Ladeuil
Clarify LogCatcher purpose. |
241 |
committed_msg = lf.revisions[0].rev.message |
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
242 |
self.assertEqual(msg, committed_msg) |
|
1185.31.22
by John Arbash Meinel
[merge] bzr.dev |
243 |
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
244 |
def test_deltas_in_merge_revisions(self): |
245 |
"""Check deltas created for both mainline and merge revisions""" |
|
246 |
wt = self.make_branch_and_tree('parent') |
|
247 |
self.build_tree(['parent/file1', 'parent/file2', 'parent/file3']) |
|
248 |
wt.add('file1') |
|
249 |
wt.add('file2') |
|
250 |
wt.commit(message='add file1 and file2') |
|
|
2581.1.6
by Martin Pool
fix up more run_bzr callers |
251 |
self.run_bzr('branch parent child') |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
252 |
os.unlink('child/file1') |
|
2911.6.1
by Blake Winton
Change 'print >> f,'s to 'f.write('s. |
253 |
file('child/file2', 'wb').write('hello\n') |
|
2581.1.6
by Martin Pool
fix up more run_bzr callers |
254 |
self.run_bzr(['commit', '-m', 'remove file1 and modify file2', |
255 |
'child']) |
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
256 |
os.chdir('parent') |
|
2581.1.6
by Martin Pool
fix up more run_bzr callers |
257 |
self.run_bzr('merge ../child') |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
258 |
wt.commit('merge child branch') |
259 |
os.chdir('..') |
|
260 |
b = wt.branch |
|
261 |
lf = LogCatcher() |
|
262 |
lf.supports_merge_revisions = True |
|
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
263 |
log.show_log(b, lf, verbose=True) |
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
264 |
|
|
4325.4.4
by Vincent Ladeuil
Clarify LogCatcher purpose. |
265 |
revs = lf.revisions |
266 |
self.assertEqual(3, len(revs)) |
|
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
267 |
|
|
4325.4.4
by Vincent Ladeuil
Clarify LogCatcher purpose. |
268 |
logentry = revs[0] |
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
269 |
self.assertEqual('2', logentry.revno) |
270 |
self.assertEqual('merge child branch', logentry.rev.message) |
|
271 |
self.checkDelta(logentry.delta, removed=['file1'], modified=['file2']) |
|
272 |
||
|
4325.4.4
by Vincent Ladeuil
Clarify LogCatcher purpose. |
273 |
logentry = revs[1] |
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
274 |
self.assertEqual('1.1.1', logentry.revno) |
275 |
self.assertEqual('remove file1 and modify file2', logentry.rev.message) |
|
276 |
self.checkDelta(logentry.delta, removed=['file1'], modified=['file2']) |
|
277 |
||
|
4325.4.4
by Vincent Ladeuil
Clarify LogCatcher purpose. |
278 |
logentry = revs[2] |
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
279 |
self.assertEqual('1', logentry.revno) |
280 |
self.assertEqual('add file1 and file2', logentry.rev.message) |
|
281 |
self.checkDelta(logentry.delta, added=['file1', 'file2']) |
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
282 |
|
283 |
||
284 |
||
|
2978.6.1
by Kent Gibson
Use normalize_log to more accurately test blackbox log output. |
285 |
def normalize_log(log): |
286 |
"""Replaces the variable lines of logs with fixed lines""" |
|
287 |
author = 'author: Dolor Sit <test@example.com>' |
|
288 |
committer = 'committer: Lorem Ipsum <test@example.com>' |
|
289 |
lines = log.splitlines(True) |
|
290 |
for idx,line in enumerate(lines): |
|
291 |
stripped_line = line.lstrip() |
|
292 |
indent = ' ' * (len(line) - len(stripped_line)) |
|
293 |
if stripped_line.startswith('author:'): |
|
294 |
lines[idx] = indent + author + '\n' |
|
295 |
elif stripped_line.startswith('committer:'): |
|
296 |
lines[idx] = indent + committer + '\n' |
|
297 |
elif stripped_line.startswith('timestamp:'): |
|
298 |
lines[idx] = indent + 'timestamp: Just now\n' |
|
299 |
return ''.join(lines) |
|
300 |
||
301 |
||
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
302 |
class TestShortLogFormatter(TestCaseForLogFormatter): |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
303 |
|
|
1185.31.21
by John Arbash Meinel
Added test for log formatting, found bug when redirecting short logs to a file instead of stdout. |
304 |
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. |
305 |
wt = self.make_branch_and_tree('.') |
|
4955.4.1
by Vincent Ladeuil
Refactor the function into an helper. |
306 |
b = self.make_commits_with_trailing_newlines(wt) |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
307 |
self.assertFormatterResult("""\ |
|
1185.31.21
by John Arbash Meinel
Added test for log formatting, found bug when redirecting short logs to a file instead of stdout. |
308 |
3 Joe Foo\t2005-11-21 |
309 |
single line with trailing newline
|
|
310 |
||
|
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. |
311 |
2 Joe Bar\t2005-11-21 |
|
1185.31.21
by John Arbash Meinel
Added test for log formatting, found bug when redirecting short logs to a file instead of stdout. |
312 |
multiline
|
313 |
log
|
|
314 |
message
|
|
315 |
||
316 |
1 Joe Foo\t2005-11-21 |
|
317 |
simple log message
|
|
318 |
||
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
319 |
""", |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
320 |
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. |
321 |
|
|
2997.1.1
by Kent Gibson
Support logging single merge revisions with short and line log formatters. |
322 |
def test_short_log_with_merges(self): |
|
3946.3.2
by Ian Clatworthy
add tests & NEWS item |
323 |
wt = self._prepare_tree_with_merges() |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
324 |
self.assertFormatterResult("""\ |
|
2997.1.1
by Kent Gibson
Support logging single merge revisions with short and line log formatters. |
325 |
2 Joe Foo\t2005-11-22 [merge] |
326 |
rev-2
|
|
327 |
||
328 |
1 Joe Foo\t2005-11-22 |
|
329 |
rev-1
|
|
330 |
||
|
4221.2.3
by Ian Clatworthy
jam feedback: don't show advice if --levels explicitly given |
331 |
""", |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
332 |
wt.branch, log.ShortLogFormatter) |
|
4221.2.3
by Ian Clatworthy
jam feedback: don't show advice if --levels explicitly given |
333 |
|
334 |
def test_short_log_with_merges_and_advice(self): |
|
335 |
wt = self._prepare_tree_with_merges() |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
336 |
self.assertFormatterResult("""\ |
|
4221.2.3
by Ian Clatworthy
jam feedback: don't show advice if --levels explicitly given |
337 |
2 Joe Foo\t2005-11-22 [merge] |
338 |
rev-2
|
|
339 |
||
340 |
1 Joe Foo\t2005-11-22 |
|
341 |
rev-1
|
|
342 |
||
|
4221.2.1
by Ian Clatworthy
--include-merges as an alias for --levels 0 in log |
343 |
Use --include-merges or -n0 to see merged revisions.
|
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
344 |
""", |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
345 |
wt.branch, log.ShortLogFormatter, |
346 |
formatter_kwargs=dict(show_advice=True)) |
|
|
2997.1.1
by Kent Gibson
Support logging single merge revisions with short and line log formatters. |
347 |
|
|
3943.4.2
by John Arbash Meinel
Add a test case which exercises this code path. |
348 |
def test_short_log_with_merges_and_range(self): |
349 |
wt = self.make_branch_and_memory_tree('.') |
|
350 |
wt.lock_write() |
|
351 |
self.addCleanup(wt.unlock) |
|
352 |
wt.add('') |
|
353 |
wt.commit('rev-1', rev_id='rev-1', |
|
354 |
timestamp=1132586655, timezone=36000, |
|
355 |
committer='Joe Foo <joe@foo.com>') |
|
356 |
wt.commit('rev-merged', rev_id='rev-2a', |
|
357 |
timestamp=1132586700, timezone=36000, |
|
358 |
committer='Joe Foo <joe@foo.com>') |
|
359 |
wt.branch.set_last_revision_info(1, 'rev-1') |
|
360 |
wt.set_parent_ids(['rev-1', 'rev-2a']) |
|
361 |
wt.commit('rev-2b', rev_id='rev-2b', |
|
362 |
timestamp=1132586800, timezone=36000, |
|
363 |
committer='Joe Foo <joe@foo.com>') |
|
364 |
wt.commit('rev-3a', rev_id='rev-3a', |
|
365 |
timestamp=1132586800, timezone=36000, |
|
366 |
committer='Joe Foo <joe@foo.com>') |
|
367 |
wt.branch.set_last_revision_info(2, 'rev-2b') |
|
368 |
wt.set_parent_ids(['rev-2b', 'rev-3a']) |
|
369 |
wt.commit('rev-3b', rev_id='rev-3b', |
|
370 |
timestamp=1132586800, timezone=36000, |
|
371 |
committer='Joe Foo <joe@foo.com>') |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
372 |
self.assertFormatterResult("""\ |
|
3943.4.2
by John Arbash Meinel
Add a test case which exercises this code path. |
373 |
3 Joe Foo\t2005-11-22 [merge] |
374 |
rev-3b
|
|
375 |
||
376 |
2 Joe Foo\t2005-11-22 [merge] |
|
377 |
rev-2b
|
|
378 |
||
379 |
""", |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
380 |
wt.branch, log.ShortLogFormatter, |
381 |
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. |
382 |
|
|
3946.3.2
by Ian Clatworthy
add tests & NEWS item |
383 |
def test_short_log_with_tags(self): |
384 |
wt = self._prepare_tree_with_merges(with_tags=True) |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
385 |
self.assertFormatterResult("""\ |
|
3946.3.2
by Ian Clatworthy
add tests & NEWS item |
386 |
3 Jane Foo\t2005-11-22 {v1.0, v1.0rc1} |
387 |
rev-3
|
|
388 |
||
389 |
2 Joe Foo\t2005-11-22 {v0.2} [merge] |
|
390 |
rev-2
|
|
391 |
||
392 |
1 Joe Foo\t2005-11-22 |
|
393 |
rev-1
|
|
394 |
||
395 |
""", |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
396 |
wt.branch, log.ShortLogFormatter) |
|
3946.3.2
by Ian Clatworthy
add tests & NEWS item |
397 |
|
|
2997.1.1
by Kent Gibson
Support logging single merge revisions with short and line log formatters. |
398 |
def test_short_log_single_merge_revision(self): |
399 |
wt = self.make_branch_and_memory_tree('.') |
|
400 |
wt.lock_write() |
|
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
401 |
self.addCleanup(wt.unlock) |
402 |
wt.add('') |
|
403 |
wt.commit('rev-1', rev_id='rev-1', |
|
404 |
timestamp=1132586655, timezone=36000, |
|
405 |
committer='Joe Foo <joe@foo.com>') |
|
406 |
wt.commit('rev-merged', rev_id='rev-2a', |
|
407 |
timestamp=1132586700, timezone=36000, |
|
408 |
committer='Joe Foo <joe@foo.com>') |
|
409 |
wt.set_parent_ids(['rev-1', 'rev-2a']) |
|
410 |
wt.branch.set_last_revision_info(1, 'rev-1') |
|
411 |
wt.commit('rev-2', rev_id='rev-2b', |
|
412 |
timestamp=1132586800, timezone=36000, |
|
413 |
committer='Joe Foo <joe@foo.com>') |
|
414 |
revspec = revisionspec.RevisionSpec.from_string('1.1.1') |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
415 |
rev = revspec.in_history(wt.branch) |
416 |
self.assertFormatterResult("""\ |
|
|
3947.1.10
by Ian Clatworthy
review feedback from vila |
417 |
1.1.1 Joe Foo\t2005-11-22 |
418 |
rev-merged
|
|
|
2997.1.1
by Kent Gibson
Support logging single merge revisions with short and line log formatters. |
419 |
|
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
420 |
""", |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
421 |
wt.branch, log.ShortLogFormatter, |
422 |
show_log_kwargs=dict(start_revision=rev, end_revision=rev)) |
|
423 |
||
424 |
||
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
425 |
class TestShortLogFormatterWithMergeRevisions(TestCaseForLogFormatter): |
|
3947.1.2
by Ian Clatworthy
formatter tests |
426 |
|
427 |
def test_short_merge_revs_log_with_merges(self): |
|
428 |
wt = self.make_branch_and_memory_tree('.') |
|
429 |
wt.lock_write() |
|
430 |
self.addCleanup(wt.unlock) |
|
431 |
wt.add('') |
|
432 |
wt.commit('rev-1', rev_id='rev-1', |
|
433 |
timestamp=1132586655, timezone=36000, |
|
434 |
committer='Joe Foo <joe@foo.com>') |
|
435 |
wt.commit('rev-merged', rev_id='rev-2a', |
|
436 |
timestamp=1132586700, timezone=36000, |
|
437 |
committer='Joe Foo <joe@foo.com>') |
|
438 |
wt.set_parent_ids(['rev-1', 'rev-2a']) |
|
439 |
wt.branch.set_last_revision_info(1, 'rev-1') |
|
440 |
wt.commit('rev-2', rev_id='rev-2b', |
|
441 |
timestamp=1132586800, timezone=36000, |
|
442 |
committer='Joe Foo <joe@foo.com>') |
|
|
3947.1.7
by Ian Clatworthy
tweak indenting/offsetting for --short given dotted revno lengths |
443 |
# Note that the 1.1.1 indenting is in fact correct given that
|
444 |
# the revision numbers are right justified within 5 characters
|
|
445 |
# for mainline revnos and 9 characters for dotted revnos.
|
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
446 |
self.assertFormatterResult("""\ |
|
3947.1.2
by Ian Clatworthy
formatter tests |
447 |
2 Joe Foo\t2005-11-22 [merge] |
448 |
rev-2
|
|
449 |
||
|
3947.1.10
by Ian Clatworthy
review feedback from vila |
450 |
1.1.1 Joe Foo\t2005-11-22 |
451 |
rev-merged
|
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
452 |
|
453 |
1 Joe Foo\t2005-11-22 |
|
454 |
rev-1
|
|
455 |
||
456 |
""", |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
457 |
wt.branch, log.ShortLogFormatter, |
458 |
formatter_kwargs=dict(levels=0)) |
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
459 |
|
460 |
def test_short_merge_revs_log_single_merge_revision(self): |
|
461 |
wt = self.make_branch_and_memory_tree('.') |
|
462 |
wt.lock_write() |
|
463 |
self.addCleanup(wt.unlock) |
|
464 |
wt.add('') |
|
465 |
wt.commit('rev-1', rev_id='rev-1', |
|
466 |
timestamp=1132586655, timezone=36000, |
|
467 |
committer='Joe Foo <joe@foo.com>') |
|
468 |
wt.commit('rev-merged', rev_id='rev-2a', |
|
469 |
timestamp=1132586700, timezone=36000, |
|
470 |
committer='Joe Foo <joe@foo.com>') |
|
471 |
wt.set_parent_ids(['rev-1', 'rev-2a']) |
|
472 |
wt.branch.set_last_revision_info(1, 'rev-1') |
|
473 |
wt.commit('rev-2', rev_id='rev-2b', |
|
474 |
timestamp=1132586800, timezone=36000, |
|
475 |
committer='Joe Foo <joe@foo.com>') |
|
476 |
revspec = revisionspec.RevisionSpec.from_string('1.1.1') |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
477 |
rev = revspec.in_history(wt.branch) |
478 |
self.assertFormatterResult("""\ |
|
|
3947.1.10
by Ian Clatworthy
review feedback from vila |
479 |
1.1.1 Joe Foo\t2005-11-22 |
480 |
rev-merged
|
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
481 |
|
482 |
""", |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
483 |
wt.branch, log.ShortLogFormatter, |
484 |
formatter_kwargs=dict(levels=0), |
|
485 |
show_log_kwargs=dict(start_revision=rev, end_revision=rev)) |
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
486 |
|
487 |
||
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
488 |
class TestLongLogFormatter(TestCaseForLogFormatter): |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
489 |
|
|
1185.33.41
by Martin Pool
Fix regression of 'bzr log -v' - it wasn't showing changed files at all. (#4676) |
490 |
def test_verbose_log(self): |
491 |
"""Verbose log includes changed files |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
492 |
|
|
1185.33.41
by Martin Pool
Fix regression of 'bzr log -v' - it wasn't showing changed files at all. (#4676) |
493 |
bug #4676
|
494 |
"""
|
|
|
4857.4.4
by John Arbash Meinel
One more standard-commit |
495 |
wt = self.make_standard_commit('test_verbose_log', authors=[]) |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
496 |
self.assertFormatterResult('''\ |
|
1185.33.41
by Martin Pool
Fix regression of 'bzr log -v' - it wasn't showing changed files at all. (#4676) |
497 |
------------------------------------------------------------
|
498 |
revno: 1
|
|
|
2671.5.7
by Lukáš Lalinsky
Rename get_author to get_apparent_author, revert the long log back to displaying the committer. |
499 |
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) |
500 |
branch nick: test_verbose_log
|
501 |
timestamp: Wed 2005-11-23 12:08:27 +1000
|
|
502 |
message:
|
|
503 |
add a
|
|
504 |
added:
|
|
505 |
a
|
|
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
506 |
''', |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
507 |
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, |
508 |
show_log_kwargs=dict(verbose=True)) |
|
1185.85.4
by John Arbash Meinel
currently broken, trying to fix things up. |
509 |
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
510 |
def test_merges_are_indented_by_level(self): |
511 |
wt = self.make_branch_and_tree('parent') |
|
512 |
wt.commit('first post') |
|
|
2581.1.6
by Martin Pool
fix up more run_bzr callers |
513 |
self.run_bzr('branch parent child') |
514 |
self.run_bzr(['commit', '-m', 'branch 1', '--unchanged', 'child']) |
|
515 |
self.run_bzr('branch child smallerchild') |
|
516 |
self.run_bzr(['commit', '-m', 'branch 2', '--unchanged', |
|
517 |
'smallerchild']) |
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
518 |
os.chdir('child') |
|
2581.1.6
by Martin Pool
fix up more run_bzr callers |
519 |
self.run_bzr('merge ../smallerchild') |
520 |
self.run_bzr(['commit', '-m', 'merge branch 2']) |
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
521 |
os.chdir('../parent') |
|
2581.1.6
by Martin Pool
fix up more run_bzr callers |
522 |
self.run_bzr('merge ../child') |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
523 |
wt.commit('merge branch 1') |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
524 |
self.assertFormatterResult("""\ |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
525 |
------------------------------------------------------------
|
|
4208.2.1
by Ian Clatworthy
merge indicators in log --long |
526 |
revno: 2 [merge]
|
|
2671.5.7
by Lukáš Lalinsky
Rename get_author to get_apparent_author, revert the long log back to displaying the committer. |
527 |
committer: Lorem Ipsum <test@example.com>
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
528 |
branch nick: parent
|
529 |
timestamp: Just now
|
|
530 |
message:
|
|
531 |
merge branch 1
|
|
532 |
------------------------------------------------------------
|
|
|
4208.2.1
by Ian Clatworthy
merge indicators in log --long |
533 |
revno: 1.1.2 [merge]
|
|
2671.5.7
by Lukáš Lalinsky
Rename get_author to get_apparent_author, revert the long log back to displaying the committer. |
534 |
committer: Lorem Ipsum <test@example.com>
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
535 |
branch nick: child
|
536 |
timestamp: Just now
|
|
537 |
message:
|
|
538 |
merge branch 2
|
|
539 |
------------------------------------------------------------
|
|
|
3170.3.4
by John Arbash Meinel
Update the tests for the new revision numbering. |
540 |
revno: 1.2.1
|
|
2671.5.7
by Lukáš Lalinsky
Rename get_author to get_apparent_author, revert the long log back to displaying the committer. |
541 |
committer: Lorem Ipsum <test@example.com>
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
542 |
branch nick: smallerchild
|
543 |
timestamp: Just now
|
|
544 |
message:
|
|
545 |
branch 2
|
|
546 |
------------------------------------------------------------
|
|
547 |
revno: 1.1.1
|
|
|
2671.5.7
by Lukáš Lalinsky
Rename get_author to get_apparent_author, revert the long log back to displaying the committer. |
548 |
committer: Lorem Ipsum <test@example.com>
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
549 |
branch nick: child
|
550 |
timestamp: Just now
|
|
551 |
message:
|
|
552 |
branch 1
|
|
553 |
------------------------------------------------------------
|
|
554 |
revno: 1
|
|
|
2671.5.7
by Lukáš Lalinsky
Rename get_author to get_apparent_author, revert the long log back to displaying the committer. |
555 |
committer: Lorem Ipsum <test@example.com>
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
556 |
branch nick: parent
|
557 |
timestamp: Just now
|
|
558 |
message:
|
|
559 |
first post
|
|
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
560 |
""", |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
561 |
wt.branch, log.LongLogFormatter, |
562 |
formatter_kwargs=dict(levels=0), |
|
563 |
show_log_kwargs=dict(verbose=True), |
|
564 |
normalize=True) |
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
565 |
|
566 |
def test_verbose_merge_revisions_contain_deltas(self): |
|
567 |
wt = self.make_branch_and_tree('parent') |
|
568 |
self.build_tree(['parent/f1', 'parent/f2']) |
|
569 |
wt.add(['f1','f2']) |
|
570 |
wt.commit('first post') |
|
|
2581.1.6
by Martin Pool
fix up more run_bzr callers |
571 |
self.run_bzr('branch parent child') |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
572 |
os.unlink('child/f1') |
|
2911.6.1
by Blake Winton
Change 'print >> f,'s to 'f.write('s. |
573 |
file('child/f2', 'wb').write('hello\n') |
|
2581.1.6
by Martin Pool
fix up more run_bzr callers |
574 |
self.run_bzr(['commit', '-m', 'removed f1 and modified f2', |
575 |
'child']) |
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
576 |
os.chdir('parent') |
|
2581.1.6
by Martin Pool
fix up more run_bzr callers |
577 |
self.run_bzr('merge ../child') |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
578 |
wt.commit('merge branch 1') |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
579 |
self.assertFormatterResult("""\ |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
580 |
------------------------------------------------------------
|
|
4208.2.1
by Ian Clatworthy
merge indicators in log --long |
581 |
revno: 2 [merge]
|
|
2671.5.7
by Lukáš Lalinsky
Rename get_author to get_apparent_author, revert the long log back to displaying the committer. |
582 |
committer: Lorem Ipsum <test@example.com>
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
583 |
branch nick: parent
|
584 |
timestamp: Just now
|
|
585 |
message:
|
|
586 |
merge branch 1
|
|
587 |
removed:
|
|
588 |
f1
|
|
589 |
modified:
|
|
590 |
f2
|
|
591 |
------------------------------------------------------------
|
|
592 |
revno: 1.1.1
|
|
|
2671.5.7
by Lukáš Lalinsky
Rename get_author to get_apparent_author, revert the long log back to displaying the committer. |
593 |
committer: Lorem Ipsum <test@example.com>
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
594 |
branch nick: child
|
595 |
timestamp: Just now
|
|
596 |
message:
|
|
597 |
removed f1 and modified f2
|
|
598 |
removed:
|
|
599 |
f1
|
|
600 |
modified:
|
|
601 |
f2
|
|
602 |
------------------------------------------------------------
|
|
603 |
revno: 1
|
|
|
2671.5.7
by Lukáš Lalinsky
Rename get_author to get_apparent_author, revert the long log back to displaying the committer. |
604 |
committer: Lorem Ipsum <test@example.com>
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
605 |
branch nick: parent
|
606 |
timestamp: Just now
|
|
607 |
message:
|
|
608 |
first post
|
|
609 |
added:
|
|
610 |
f1
|
|
611 |
f2
|
|
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
612 |
""", |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
613 |
wt.branch, log.LongLogFormatter, |
614 |
formatter_kwargs=dict(levels=0), |
|
615 |
show_log_kwargs=dict(verbose=True), |
|
616 |
normalize=True) |
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
617 |
|
618 |
def test_trailing_newlines(self): |
|
619 |
wt = self.make_branch_and_tree('.') |
|
|
4955.4.1
by Vincent Ladeuil
Refactor the function into an helper. |
620 |
b = self.make_commits_with_trailing_newlines(wt) |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
621 |
self.assertFormatterResult("""\ |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
622 |
------------------------------------------------------------
|
623 |
revno: 3
|
|
|
2671.5.7
by Lukáš Lalinsky
Rename get_author to get_apparent_author, revert the long log back to displaying the committer. |
624 |
committer: Joe Foo <joe@foo.com>
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
625 |
branch nick: test
|
626 |
timestamp: Mon 2005-11-21 09:32:56 -0600
|
|
627 |
message:
|
|
628 |
single line with trailing newline
|
|
629 |
------------------------------------------------------------
|
|
630 |
revno: 2
|
|
|
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. |
631 |
author: Joe Bar <joe@bar.com>
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
632 |
committer: Joe Foo <joe@foo.com>
|
633 |
branch nick: test
|
|
634 |
timestamp: Mon 2005-11-21 09:27:22 -0600
|
|
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
|
643 |
timestamp: Mon 2005-11-21 09:24:15 -0600
|
|
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>']) |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
656 |
self.assertFormatterResult("""\ |
|
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
|
662 |
timestamp: Wed 2005-11-23 12:08:27 +1000
|
|
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) |
|
680 |
self.assertFormatterResult("""\ |
|
|
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
|
|
3144.7.9
by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors |
687 |
timestamp: Wed 2005-11-23 12:08:27 +1000
|
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) |
|
704 |
self.assertFormatterResult("""\ |
|
|
3976.3.3
by Jelmer Vernooij
remove a tab character. |
705 |
1 John Doe\t2005-11-23 |
|
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', |
717 |
revprops={'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): |
721 |
raise StandardError("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) |
|
726 |
self.assertRaises(StandardError, 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', |
730 |
revprops={'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, '') |
|
745 |
self.assertEqualDiff('''custom_prop_name: test_value\n''', |
|
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 |
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
748 |
|
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
749 |
class TestLongLogFormatterWithoutMergeRevisions(TestCaseForLogFormatter): |
|
3947.1.2
by Ian Clatworthy
formatter tests |
750 |
|
751 |
def test_long_verbose_log(self): |
|
752 |
"""Verbose log includes changed files |
|
|
4032.1.2
by John Arbash Meinel
Track down a few more files that have trailing whitespace. |
753 |
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
754 |
bug #4676
|
755 |
"""
|
|
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
756 |
wt = self.make_standard_commit('test_long_verbose_log', authors=[]) |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
757 |
self.assertFormatterResult("""\ |
|
3947.1.2
by Ian Clatworthy
formatter tests |
758 |
------------------------------------------------------------
|
759 |
revno: 1
|
|
760 |
committer: Lorem Ipsum <test@example.com>
|
|
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
761 |
branch nick: test_long_verbose_log
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
762 |
timestamp: Wed 2005-11-23 12:08:27 +1000
|
763 |
message:
|
|
764 |
add a
|
|
765 |
added:
|
|
766 |
a
|
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
767 |
""", |
768 |
wt.branch, log.LongLogFormatter, |
|
769 |
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, |
770 |
show_log_kwargs=dict(verbose=True)) |
|
3947.1.2
by Ian Clatworthy
formatter tests |
771 |
|
772 |
def test_long_verbose_contain_deltas(self): |
|
773 |
wt = self.make_branch_and_tree('parent') |
|
774 |
self.build_tree(['parent/f1', 'parent/f2']) |
|
775 |
wt.add(['f1','f2']) |
|
776 |
wt.commit('first post') |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
777 |
child_wt = wt.bzrdir.sprout('child').open_workingtree() |
|
3947.1.2
by Ian Clatworthy
formatter tests |
778 |
os.unlink('child/f1') |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
779 |
self.build_tree_contents([('child/f2', 'hello\n')]) |
780 |
child_wt.commit('removed f1 and modified f2') |
|
781 |
wt.merge_from_branch(child_wt.branch) |
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
782 |
wt.commit('merge branch 1') |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
783 |
self.assertFormatterResult("""\ |
|
3947.1.2
by Ian Clatworthy
formatter tests |
784 |
------------------------------------------------------------
|
|
4208.2.1
by Ian Clatworthy
merge indicators in log --long |
785 |
revno: 2 [merge]
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
786 |
committer: Lorem Ipsum <test@example.com>
|
787 |
branch nick: parent
|
|
788 |
timestamp: Just now
|
|
789 |
message:
|
|
790 |
merge branch 1
|
|
791 |
removed:
|
|
792 |
f1
|
|
793 |
modified:
|
|
794 |
f2
|
|
795 |
------------------------------------------------------------
|
|
796 |
revno: 1
|
|
797 |
committer: Lorem Ipsum <test@example.com>
|
|
798 |
branch nick: parent
|
|
799 |
timestamp: Just now
|
|
800 |
message:
|
|
801 |
first post
|
|
802 |
added:
|
|
803 |
f1
|
|
804 |
f2
|
|
805 |
""", |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
806 |
wt.branch, log.LongLogFormatter, |
807 |
formatter_kwargs=dict(levels=1), |
|
808 |
show_log_kwargs=dict(verbose=True), |
|
809 |
normalize=True) |
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
810 |
|
811 |
def test_long_trailing_newlines(self): |
|
812 |
wt = self.make_branch_and_tree('.') |
|
|
4955.4.1
by Vincent Ladeuil
Refactor the function into an helper. |
813 |
b = self.make_commits_with_trailing_newlines(wt) |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
814 |
self.assertFormatterResult("""\ |
|
3947.1.2
by Ian Clatworthy
formatter tests |
815 |
------------------------------------------------------------
|
816 |
revno: 3
|
|
817 |
committer: Joe Foo <joe@foo.com>
|
|
818 |
branch nick: test
|
|
819 |
timestamp: Mon 2005-11-21 09:32:56 -0600
|
|
820 |
message:
|
|
821 |
single line with trailing newline
|
|
822 |
------------------------------------------------------------
|
|
823 |
revno: 2
|
|
824 |
author: Joe Bar <joe@bar.com>
|
|
825 |
committer: Joe Foo <joe@foo.com>
|
|
826 |
branch nick: test
|
|
827 |
timestamp: Mon 2005-11-21 09:27:22 -0600
|
|
828 |
message:
|
|
829 |
multiline
|
|
830 |
log
|
|
831 |
message
|
|
832 |
------------------------------------------------------------
|
|
833 |
revno: 1
|
|
834 |
committer: Joe Foo <joe@foo.com>
|
|
835 |
branch nick: test
|
|
836 |
timestamp: Mon 2005-11-21 09:24:15 -0600
|
|
837 |
message:
|
|
838 |
simple log message
|
|
839 |
""", |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
840 |
b, log.LongLogFormatter, |
841 |
formatter_kwargs=dict(levels=1)) |
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
842 |
|
843 |
def test_long_author_in_log(self): |
|
844 |
"""Log includes the author name if it's set in |
|
845 |
the revision properties
|
|
846 |
"""
|
|
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
847 |
wt = self.make_standard_commit('test_author_log') |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
848 |
self.assertFormatterResult("""\ |
|
3947.1.2
by Ian Clatworthy
formatter tests |
849 |
------------------------------------------------------------
|
850 |
revno: 1
|
|
851 |
author: John Doe <jdoe@example.com>
|
|
852 |
committer: Lorem Ipsum <test@example.com>
|
|
853 |
branch nick: test_author_log
|
|
854 |
timestamp: Wed 2005-11-23 12:08:27 +1000
|
|
855 |
message:
|
|
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
856 |
add a
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
857 |
""", |
858 |
wt.branch, log.LongLogFormatter, |
|
859 |
formatter_kwargs=dict(levels=1)) |
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
860 |
|
861 |
def test_long_properties_in_log(self): |
|
|
4032.1.2
by John Arbash Meinel
Track down a few more files that have trailing whitespace. |
862 |
"""Log includes the custom properties returned by the registered |
|
3947.1.2
by Ian Clatworthy
formatter tests |
863 |
handlers.
|
864 |
"""
|
|
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
865 |
wt = self.make_standard_commit('test_properties_in_log') |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
866 |
def trivial_custom_prop_handler(revision): |
867 |
return {'test_prop':'test_value'} |
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
868 |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
869 |
log.properties_handler_registry.register( |
870 |
'trivial_custom_prop_handler', |
|
871 |
trivial_custom_prop_handler) |
|
872 |
self.assertFormatterResult("""\ |
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
873 |
------------------------------------------------------------
|
874 |
revno: 1
|
|
875 |
test_prop: test_value
|
|
876 |
author: John Doe <jdoe@example.com>
|
|
877 |
committer: Lorem Ipsum <test@example.com>
|
|
878 |
branch nick: test_properties_in_log
|
|
879 |
timestamp: Wed 2005-11-23 12:08:27 +1000
|
|
880 |
message:
|
|
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
881 |
add a
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
882 |
""", |
883 |
wt.branch, log.LongLogFormatter, |
|
884 |
formatter_kwargs=dict(levels=1)) |
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
885 |
|
886 |
||
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
887 |
class TestLineLogFormatter(TestCaseForLogFormatter): |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
888 |
|
|
1704.2.20
by Martin Pool
log --line shows revision numbers (Alexander) |
889 |
def test_line_log(self): |
890 |
"""Line log should show revno |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
891 |
|
|
1704.2.20
by Martin Pool
log --line shows revision numbers (Alexander) |
892 |
bug #5162
|
893 |
"""
|
|
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
894 |
wt = self.make_standard_commit('test-line-log', |
895 |
committer='Line-Log-Formatter Tester <test@line.log>', |
|
896 |
authors=[]) |
|
897 |
self.assertFormatterResult("""\ |
|
898 |
1: Line-Log-Formatte... 2005-11-23 add a
|
|
899 |
""", |
|
900 |
wt.branch, log.LineLogFormatter) |
|
|
1756.2.20
by Aaron Bentley
Optimize log formats that don't show merges |
901 |
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
902 |
def test_trailing_newlines(self): |
903 |
wt = self.make_branch_and_tree('.') |
|
|
4955.4.1
by Vincent Ladeuil
Refactor the function into an helper. |
904 |
b = self.make_commits_with_trailing_newlines(wt) |
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
905 |
self.assertFormatterResult("""\ |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
906 |
3: Joe Foo 2005-11-21 single line with trailing newline
|
|
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. |
907 |
2: Joe Bar 2005-11-21 multiline
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
908 |
1: Joe Foo 2005-11-21 simple log message
|
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
909 |
""", |
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
910 |
b, log.LineLogFormatter) |
|
3946.3.2
by Ian Clatworthy
add tests & NEWS item |
911 |
|
|
2997.1.1
by Kent Gibson
Support logging single merge revisions with short and line log formatters. |
912 |
def test_line_log_single_merge_revision(self): |
|
3946.3.2
by Ian Clatworthy
add tests & NEWS item |
913 |
wt = self._prepare_tree_with_merges() |
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
914 |
revspec = revisionspec.RevisionSpec.from_string('1.1.1') |
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
915 |
rev = revspec.in_history(wt.branch) |
916 |
self.assertFormatterResult("""\ |
|
|
2997.1.1
by Kent Gibson
Support logging single merge revisions with short and line log formatters. |
917 |
1.1.1: Joe Foo 2005-11-22 rev-merged
|
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
918 |
""", |
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
919 |
wt.branch, log.LineLogFormatter, |
920 |
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. |
921 |
|
|
3946.3.2
by Ian Clatworthy
add tests & NEWS item |
922 |
def test_line_log_with_tags(self): |
923 |
wt = self._prepare_tree_with_merges(with_tags=True) |
|
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
924 |
self.assertFormatterResult("""\ |
|
3946.3.3
by Ian Clatworthy
feedback from jelmer re position of tags in --line |
925 |
3: Jane Foo 2005-11-22 {v1.0, v1.0rc1} rev-3
|
|
3983.2.1
by Neil Martinsen-Burrell
add merge indication to the line format |
926 |
2: Joe Foo 2005-11-22 [merge] {v0.2} rev-2 |
|
3946.3.2
by Ian Clatworthy
add tests & NEWS item |
927 |
1: Joe Foo 2005-11-22 rev-1
|
928 |
""", |
|
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
929 |
wt.branch, log.LineLogFormatter) |
930 |
||
931 |
||
932 |
class TestLineLogFormatterWithMergeRevisions(TestCaseForLogFormatter): |
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
933 |
|
934 |
def test_line_merge_revs_log(self): |
|
935 |
"""Line log should show revno |
|
|
4032.1.2
by John Arbash Meinel
Track down a few more files that have trailing whitespace. |
936 |
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
937 |
bug #5162
|
938 |
"""
|
|
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
939 |
wt = self.make_standard_commit('test-line-log', |
940 |
committer='Line-Log-Formatter Tester <test@line.log>', |
|
941 |
authors=[]) |
|
942 |
self.assertFormatterResult("""\ |
|
943 |
1: Line-Log-Formatte... 2005-11-23 add a
|
|
944 |
""", |
|
945 |
wt.branch, log.LineLogFormatter) |
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
946 |
|
947 |
def test_line_merge_revs_log_single_merge_revision(self): |
|
948 |
wt = self.make_branch_and_memory_tree('.') |
|
949 |
wt.lock_write() |
|
950 |
self.addCleanup(wt.unlock) |
|
951 |
wt.add('') |
|
952 |
wt.commit('rev-1', rev_id='rev-1', |
|
953 |
timestamp=1132586655, timezone=36000, |
|
954 |
committer='Joe Foo <joe@foo.com>') |
|
955 |
wt.commit('rev-merged', rev_id='rev-2a', |
|
956 |
timestamp=1132586700, timezone=36000, |
|
957 |
committer='Joe Foo <joe@foo.com>') |
|
958 |
wt.set_parent_ids(['rev-1', 'rev-2a']) |
|
959 |
wt.branch.set_last_revision_info(1, 'rev-1') |
|
960 |
wt.commit('rev-2', rev_id='rev-2b', |
|
961 |
timestamp=1132586800, timezone=36000, |
|
962 |
committer='Joe Foo <joe@foo.com>') |
|
963 |
revspec = revisionspec.RevisionSpec.from_string('1.1.1') |
|
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
964 |
rev = revspec.in_history(wt.branch) |
965 |
self.assertFormatterResult("""\ |
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
966 |
1.1.1: Joe Foo 2005-11-22 rev-merged
|
967 |
""", |
|
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
968 |
wt.branch, log.LineLogFormatter, |
969 |
formatter_kwargs=dict(levels=0), |
|
970 |
show_log_kwargs=dict(start_revision=rev, end_revision=rev)) |
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
971 |
|
972 |
def test_line_merge_revs_log_with_merges(self): |
|
973 |
wt = self.make_branch_and_memory_tree('.') |
|
974 |
wt.lock_write() |
|
975 |
self.addCleanup(wt.unlock) |
|
976 |
wt.add('') |
|
977 |
wt.commit('rev-1', rev_id='rev-1', |
|
978 |
timestamp=1132586655, timezone=36000, |
|
979 |
committer='Joe Foo <joe@foo.com>') |
|
980 |
wt.commit('rev-merged', rev_id='rev-2a', |
|
981 |
timestamp=1132586700, timezone=36000, |
|
982 |
committer='Joe Foo <joe@foo.com>') |
|
983 |
wt.set_parent_ids(['rev-1', 'rev-2a']) |
|
984 |
wt.branch.set_last_revision_info(1, 'rev-1') |
|
985 |
wt.commit('rev-2', rev_id='rev-2b', |
|
986 |
timestamp=1132586800, timezone=36000, |
|
987 |
committer='Joe Foo <joe@foo.com>') |
|
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
988 |
self.assertFormatterResult("""\ |
|
3983.2.1
by Neil Martinsen-Burrell
add merge indication to the line format |
989 |
2: Joe Foo 2005-11-22 [merge] rev-2
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
990 |
1.1.1: Joe Foo 2005-11-22 rev-merged
|
991 |
1: Joe Foo 2005-11-22 rev-1
|
|
992 |
""", |
|
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
993 |
wt.branch, log.LineLogFormatter, |
994 |
formatter_kwargs=dict(levels=0)) |
|
995 |
||
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
996 |
|
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
997 |
class TestGetViewRevisions(tests.TestCaseWithTransport): |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
998 |
|
|
1756.2.22
by Aaron Bentley
Apply review comments |
999 |
def make_tree_with_commits(self): |
1000 |
"""Create a tree with well-known revision ids""" |
|
|
1756.2.20
by Aaron Bentley
Optimize log formats that don't show merges |
1001 |
wt = self.make_branch_and_tree('tree1') |
1002 |
wt.commit('commit one', rev_id='1') |
|
1003 |
wt.commit('commit two', rev_id='2') |
|
1004 |
wt.commit('commit three', rev_id='3') |
|
1005 |
mainline_revs = [None, '1', '2', '3'] |
|
|
1756.2.22
by Aaron Bentley
Apply review comments |
1006 |
rev_nos = {'1': 1, '2': 2, '3': 3} |
1007 |
return mainline_revs, rev_nos, wt |
|
1008 |
||
1009 |
def make_tree_with_merges(self): |
|
1010 |
"""Create a tree with well-known revision ids and a merge""" |
|
1011 |
mainline_revs, rev_nos, wt = self.make_tree_with_commits() |
|
|
1756.2.20
by Aaron Bentley
Optimize log formats that don't show merges |
1012 |
tree2 = wt.bzrdir.sprout('tree2').open_workingtree() |
1013 |
tree2.commit('four-a', rev_id='4a') |
|
|
1979.2.1
by Robert Collins
(robertc) adds a convenience method "merge_from_branch" to WorkingTree. |
1014 |
wt.merge_from_branch(tree2.branch) |
|
1756.2.20
by Aaron Bentley
Optimize log formats that don't show merges |
1015 |
wt.commit('four-b', rev_id='4b') |
1016 |
mainline_revs.append('4b') |
|
|
1756.2.22
by Aaron Bentley
Apply review comments |
1017 |
rev_nos['4b'] = 4 |
|
1988.4.2
by Robert Collins
``bzr log`` Now shows dotted-decimal revision numbers for all revisions, |
1018 |
# 4a: 3.1.1
|
|
1756.2.22
by Aaron Bentley
Apply review comments |
1019 |
return mainline_revs, rev_nos, wt |
1020 |
||
|
4615.1.2
by John Arbash Meinel
clarify the test a bit by using BranchBuilder. |
1021 |
def make_branch_with_many_merges(self): |
|
1756.2.24
by Aaron Bentley
Forward sorting shows merges under mainline revision |
1022 |
"""Create a tree with well-known revision ids""" |
|
4615.1.2
by John Arbash Meinel
clarify the test a bit by using BranchBuilder. |
1023 |
builder = self.make_branch_builder('tree1') |
1024 |
builder.start_series() |
|
1025 |
builder.build_snapshot('1', None, [ |
|
1026 |
('add', ('', 'TREE_ROOT', 'directory', '')), |
|
1027 |
('add', ('f', 'f-id', 'file', '1\n'))]) |
|
1028 |
builder.build_snapshot('2', ['1'], []) |
|
1029 |
builder.build_snapshot('3a', ['2'], [ |
|
1030 |
('modify', ('f-id', '1\n2\n3a\n'))]) |
|
1031 |
builder.build_snapshot('3b', ['2', '3a'], [ |
|
1032 |
('modify', ('f-id', '1\n2\n3a\n'))]) |
|
1033 |
builder.build_snapshot('3c', ['2', '3b'], [ |
|
1034 |
('modify', ('f-id', '1\n2\n3a\n'))]) |
|
1035 |
builder.build_snapshot('4a', ['3b'], []) |
|
1036 |
builder.build_snapshot('4b', ['3c', '4a'], []) |
|
1037 |
builder.finish_series() |
|
1038 |
||
1039 |
# 1
|
|
1040 |
# |
|
|
1041 |
# 2-.
|
|
1042 |
# |\ \
|
|
1043 |
# | | 3a
|
|
1044 |
# | |/
|
|
1045 |
# | 3b
|
|
1046 |
# |/|
|
|
1047 |
# 3c4a
|
|
1048 |
# |/
|
|
1049 |
# 4b
|
|
|
3842.2.5
by Vincent Ladeuil
Better fix for bug #300055. |
1050 |
|
|
1756.2.24
by Aaron Bentley
Forward sorting shows merges under mainline revision |
1051 |
mainline_revs = [None, '1', '2', '3c', '4b'] |
|
1988.4.2
by Robert Collins
``bzr log`` Now shows dotted-decimal revision numbers for all revisions, |
1052 |
rev_nos = {'1':1, '2':2, '3c': 3, '4b':4} |
1053 |
full_rev_nos_for_reference = { |
|
1054 |
'1': '1', |
|
1055 |
'2': '2', |
|
|
3170.3.4
by John Arbash Meinel
Update the tests for the new revision numbering. |
1056 |
'3a': '2.1.1', #first commit tree 3 |
1057 |
'3b': '2.2.1', # first commit tree 2 |
|
|
1988.4.2
by Robert Collins
``bzr log`` Now shows dotted-decimal revision numbers for all revisions, |
1058 |
'3c': '3', #merges 3b to main |
|
3170.3.4
by John Arbash Meinel
Update the tests for the new revision numbering. |
1059 |
'4a': '2.2.2', # second commit tree 2 |
|
1988.4.2
by Robert Collins
``bzr log`` Now shows dotted-decimal revision numbers for all revisions, |
1060 |
'4b': '4', # merges 4a to main |
1061 |
}
|
|
|
4615.1.2
by John Arbash Meinel
clarify the test a bit by using BranchBuilder. |
1062 |
return mainline_revs, rev_nos, builder.get_branch() |
|
1756.2.24
by Aaron Bentley
Forward sorting shows merges under mainline revision |
1063 |
|
|
1756.2.22
by Aaron Bentley
Apply review comments |
1064 |
def test_get_view_revisions_forward(self): |
1065 |
"""Test the get_view_revisions method""" |
|
1066 |
mainline_revs, rev_nos, wt = self.make_tree_with_commits() |
|
|
3287.6.1
by Robert Collins
* ``VersionedFile.get_graph`` is deprecated, with no replacement method. |
1067 |
wt.lock_read() |
1068 |
self.addCleanup(wt.unlock) |
|
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
1069 |
revisions = list(log.get_view_revisions( |
1070 |
mainline_revs, rev_nos, wt.branch, 'forward')) |
|
|
1988.4.2
by Robert Collins
``bzr log`` Now shows dotted-decimal revision numbers for all revisions, |
1071 |
self.assertEqual([('1', '1', 0), ('2', '2', 0), ('3', '3', 0)], |
|
3842.2.2
by Vincent Ladeuil
Reproduce bug #300055. |
1072 |
revisions) |
1073 |
revisions2 = list(log.get_view_revisions( |
|
1074 |
mainline_revs, rev_nos, wt.branch, 'forward', |
|
1075 |
include_merges=False)) |
|
|
1756.2.22
by Aaron Bentley
Apply review comments |
1076 |
self.assertEqual(revisions, revisions2) |
1077 |
||
1078 |
def test_get_view_revisions_reverse(self): |
|
1079 |
"""Test the get_view_revisions with reverse""" |
|
1080 |
mainline_revs, rev_nos, wt = self.make_tree_with_commits() |
|
|
3287.6.1
by Robert Collins
* ``VersionedFile.get_graph`` is deprecated, with no replacement method. |
1081 |
wt.lock_read() |
1082 |
self.addCleanup(wt.unlock) |
|
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
1083 |
revisions = list(log.get_view_revisions( |
1084 |
mainline_revs, rev_nos, wt.branch, 'reverse')) |
|
|
1988.4.2
by Robert Collins
``bzr log`` Now shows dotted-decimal revision numbers for all revisions, |
1085 |
self.assertEqual([('3', '3', 0), ('2', '2', 0), ('1', '1', 0), ], |
|
3842.2.2
by Vincent Ladeuil
Reproduce bug #300055. |
1086 |
revisions) |
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
1087 |
revisions2 = list(log.get_view_revisions( |
1088 |
mainline_revs, rev_nos, wt.branch, 'reverse', |
|
1089 |
include_merges=False)) |
|
|
1756.2.22
by Aaron Bentley
Apply review comments |
1090 |
self.assertEqual(revisions, revisions2) |
1091 |
||
1092 |
def test_get_view_revisions_merge(self): |
|
1093 |
"""Test get_view_revisions when there are merges""" |
|
1094 |
mainline_revs, rev_nos, wt = self.make_tree_with_merges() |
|
|
3287.6.1
by Robert Collins
* ``VersionedFile.get_graph`` is deprecated, with no replacement method. |
1095 |
wt.lock_read() |
1096 |
self.addCleanup(wt.unlock) |
|
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
1097 |
revisions = list(log.get_view_revisions( |
1098 |
mainline_revs, rev_nos, wt.branch, 'forward')) |
|
|
1988.4.2
by Robert Collins
``bzr log`` Now shows dotted-decimal revision numbers for all revisions, |
1099 |
self.assertEqual([('1', '1', 0), ('2', '2', 0), ('3', '3', 0), |
|
3842.2.2
by Vincent Ladeuil
Reproduce bug #300055. |
1100 |
('4b', '4', 0), ('4a', '3.1.1', 1)], |
1101 |
revisions) |
|
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
1102 |
revisions = list(log.get_view_revisions( |
1103 |
mainline_revs, rev_nos, wt.branch, 'forward', |
|
1104 |
include_merges=False)) |
|
|
1988.4.2
by Robert Collins
``bzr log`` Now shows dotted-decimal revision numbers for all revisions, |
1105 |
self.assertEqual([('1', '1', 0), ('2', '2', 0), ('3', '3', 0), |
|
3842.2.2
by Vincent Ladeuil
Reproduce bug #300055. |
1106 |
('4b', '4', 0)], |
1107 |
revisions) |
|
|
1756.2.24
by Aaron Bentley
Forward sorting shows merges under mainline revision |
1108 |
|
1109 |
def test_get_view_revisions_merge_reverse(self): |
|
1110 |
"""Test get_view_revisions in reverse when there are merges""" |
|
1111 |
mainline_revs, rev_nos, wt = self.make_tree_with_merges() |
|
|
3287.6.1
by Robert Collins
* ``VersionedFile.get_graph`` is deprecated, with no replacement method. |
1112 |
wt.lock_read() |
1113 |
self.addCleanup(wt.unlock) |
|
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
1114 |
revisions = list(log.get_view_revisions( |
1115 |
mainline_revs, rev_nos, wt.branch, 'reverse')) |
|
|
1988.4.2
by Robert Collins
``bzr log`` Now shows dotted-decimal revision numbers for all revisions, |
1116 |
self.assertEqual([('4b', '4', 0), ('4a', '3.1.1', 1), |
|
3842.2.2
by Vincent Ladeuil
Reproduce bug #300055. |
1117 |
('3', '3', 0), ('2', '2', 0), ('1', '1', 0)], |
1118 |
revisions) |
|
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
1119 |
revisions = list(log.get_view_revisions( |
1120 |
mainline_revs, rev_nos, wt.branch, 'reverse', |
|
1121 |
include_merges=False)) |
|
|
1988.4.2
by Robert Collins
``bzr log`` Now shows dotted-decimal revision numbers for all revisions, |
1122 |
self.assertEqual([('4b', '4', 0), ('3', '3', 0), ('2', '2', 0), |
|
3842.2.2
by Vincent Ladeuil
Reproduce bug #300055. |
1123 |
('1', '1', 0)], |
1124 |
revisions) |
|
|
1756.2.24
by Aaron Bentley
Forward sorting shows merges under mainline revision |
1125 |
|
1126 |
def test_get_view_revisions_merge2(self): |
|
1127 |
"""Test get_view_revisions when there are merges""" |
|
|
4615.1.2
by John Arbash Meinel
clarify the test a bit by using BranchBuilder. |
1128 |
mainline_revs, rev_nos, b = self.make_branch_with_many_merges() |
1129 |
b.lock_read() |
|
1130 |
self.addCleanup(b.unlock) |
|
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
1131 |
revisions = list(log.get_view_revisions( |
|
4615.1.2
by John Arbash Meinel
clarify the test a bit by using BranchBuilder. |
1132 |
mainline_revs, rev_nos, b, 'forward')) |
|
1988.4.2
by Robert Collins
``bzr log`` Now shows dotted-decimal revision numbers for all revisions, |
1133 |
expected = [('1', '1', 0), ('2', '2', 0), ('3c', '3', 0), |
|
4615.1.3
by John Arbash Meinel
Since the merge depth changed, it causes log to change slightly as well. |
1134 |
('3b', '2.2.1', 1), ('3a', '2.1.1', 2), ('4b', '4', 0), |
|
3842.2.2
by Vincent Ladeuil
Reproduce bug #300055. |
1135 |
('4a', '2.2.2', 1)] |
|
1988.4.2
by Robert Collins
``bzr log`` Now shows dotted-decimal revision numbers for all revisions, |
1136 |
self.assertEqual(expected, revisions) |
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
1137 |
revisions = list(log.get_view_revisions( |
|
4615.1.2
by John Arbash Meinel
clarify the test a bit by using BranchBuilder. |
1138 |
mainline_revs, rev_nos, b, 'forward', |
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
1139 |
include_merges=False)) |
|
1988.4.2
by Robert Collins
``bzr log`` Now shows dotted-decimal revision numbers for all revisions, |
1140 |
self.assertEqual([('1', '1', 0), ('2', '2', 0), ('3c', '3', 0), |
|
3842.2.2
by Vincent Ladeuil
Reproduce bug #300055. |
1141 |
('4b', '4', 0)], |
1142 |
revisions) |
|
|
2359.1.6
by John Arbash Meinel
Create a helper tree which has a semi-interesting history. |
1143 |
|
1144 |
||
|
3842.2.5
by Vincent Ladeuil
Better fix for bug #300055. |
1145 |
def test_file_id_for_range(self): |
|
4615.1.2
by John Arbash Meinel
clarify the test a bit by using BranchBuilder. |
1146 |
mainline_revs, rev_nos, b = self.make_branch_with_many_merges() |
1147 |
b.lock_read() |
|
1148 |
self.addCleanup(b.unlock) |
|
|
3842.2.5
by Vincent Ladeuil
Better fix for bug #300055. |
1149 |
|
1150 |
def rev_from_rev_id(revid, branch): |
|
1151 |
revspec = revisionspec.RevisionSpec.from_string('revid:%s' % revid) |
|
1152 |
return revspec.in_history(branch) |
|
1153 |
||
1154 |
def view_revs(start_rev, end_rev, file_id, direction): |
|
1155 |
revs = log.calculate_view_revisions( |
|
|
4615.1.2
by John Arbash Meinel
clarify the test a bit by using BranchBuilder. |
1156 |
b, |
|
3842.2.5
by Vincent Ladeuil
Better fix for bug #300055. |
1157 |
start_rev, # start_revision |
1158 |
end_rev, # end_revision |
|
1159 |
direction, # direction |
|
1160 |
file_id, # specific_fileid |
|
1161 |
True, # generate_merge_revisions |
|
1162 |
)
|
|
1163 |
return revs |
|
1164 |
||
|
4615.1.2
by John Arbash Meinel
clarify the test a bit by using BranchBuilder. |
1165 |
rev_3a = rev_from_rev_id('3a', b) |
1166 |
rev_4b = rev_from_rev_id('4b', b) |
|
|
4615.1.3
by John Arbash Meinel
Since the merge depth changed, it causes log to change slightly as well. |
1167 |
self.assertEqual([('3c', '3', 0), ('3b', '2.2.1', 1), ('3a', '2.1.1', 2)], |
|
3842.2.5
by Vincent Ladeuil
Better fix for bug #300055. |
1168 |
view_revs(rev_3a, rev_4b, 'f-id', 'reverse')) |
|
3936.3.30
by Ian Clatworthy
use iter_merge_sorted_revisions() with stop_range feature |
1169 |
# Note: 3c still appears before 3a here because of depth-based sorting
|
|
4615.1.3
by John Arbash Meinel
Since the merge depth changed, it causes log to change slightly as well. |
1170 |
self.assertEqual([('3c', '3', 0), ('3b', '2.2.1', 1), ('3a', '2.1.1', 2)], |
|
3842.2.5
by Vincent Ladeuil
Better fix for bug #300055. |
1171 |
view_revs(rev_3a, rev_4b, 'f-id', 'forward')) |
1172 |
||
1173 |
||
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
1174 |
class TestGetRevisionsTouchingFileID(tests.TestCaseWithTransport): |
|
2359.1.6
by John Arbash Meinel
Create a helper tree which has a semi-interesting history. |
1175 |
|
1176 |
def create_tree_with_single_merge(self): |
|
1177 |
"""Create a branch with a moderate layout. |
|
1178 |
||
1179 |
The revision graph looks like:
|
|
1180 |
||
1181 |
A
|
|
1182 |
|\
|
|
1183 |
B C
|
|
1184 |
|/
|
|
1185 |
D
|
|
1186 |
||
1187 |
In this graph, A introduced files f1 and f2 and f3.
|
|
1188 |
B modifies f1 and f3, and C modifies f2 and f3.
|
|
1189 |
D merges the changes from B and C and resolves the conflict for f3.
|
|
1190 |
"""
|
|
1191 |
# TODO: jam 20070218 This seems like it could really be done
|
|
1192 |
# with make_branch_and_memory_tree() if we could just
|
|
1193 |
# create the content of those files.
|
|
1194 |
# TODO: jam 20070218 Another alternative is that we would really
|
|
1195 |
# like to only create this tree 1 time for all tests that
|
|
1196 |
# use it. Since 'log' only uses the tree in a readonly
|
|
1197 |
# fashion, it seems a shame to regenerate an identical
|
|
1198 |
# tree for each test.
|
|
1199 |
tree = self.make_branch_and_tree('tree') |
|
1200 |
tree.lock_write() |
|
1201 |
self.addCleanup(tree.unlock) |
|
1202 |
||
1203 |
self.build_tree_contents([('tree/f1', 'A\n'), |
|
1204 |
('tree/f2', 'A\n'), |
|
1205 |
('tree/f3', 'A\n'), |
|
1206 |
])
|
|
1207 |
tree.add(['f1', 'f2', 'f3'], ['f1-id', 'f2-id', 'f3-id']) |
|
1208 |
tree.commit('A', rev_id='A') |
|
1209 |
||
1210 |
self.build_tree_contents([('tree/f2', 'A\nC\n'), |
|
1211 |
('tree/f3', 'A\nC\n'), |
|
1212 |
])
|
|
1213 |
tree.commit('C', rev_id='C') |
|
1214 |
# Revert back to A to build the other history.
|
|
1215 |
tree.set_last_revision('A') |
|
1216 |
tree.branch.set_last_revision_info(1, 'A') |
|
1217 |
self.build_tree_contents([('tree/f1', 'A\nB\n'), |
|
1218 |
('tree/f2', 'A\n'), |
|
1219 |
('tree/f3', 'A\nB\n'), |
|
1220 |
])
|
|
1221 |
tree.commit('B', rev_id='B') |
|
1222 |
tree.set_parent_ids(['B', 'C']) |
|
1223 |
self.build_tree_contents([('tree/f1', 'A\nB\n'), |
|
1224 |
('tree/f2', 'A\nC\n'), |
|
1225 |
('tree/f3', 'A\nB\nC\n'), |
|
1226 |
])
|
|
1227 |
tree.commit('D', rev_id='D') |
|
1228 |
||
1229 |
# Switch to a read lock for this tree.
|
|
|
3842.2.5
by Vincent Ladeuil
Better fix for bug #300055. |
1230 |
# We still have an addCleanup(tree.unlock) pending
|
|
2359.1.6
by John Arbash Meinel
Create a helper tree which has a semi-interesting history. |
1231 |
tree.unlock() |
1232 |
tree.lock_read() |
|
1233 |
return tree |
|
1234 |
||
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
1235 |
def check_delta(self, delta, **kw): |
1236 |
"""Check the filenames touched by a delta are as expected. |
|
1237 |
||
1238 |
Caller only have to pass in the list of files for each part, all
|
|
1239 |
unspecified parts are considered empty (and checked as such).
|
|
1240 |
"""
|
|
1241 |
for n in 'added', 'removed', 'renamed', 'modified', 'unchanged': |
|
1242 |
# By default we expect an empty list
|
|
1243 |
expected = kw.get(n, []) |
|
1244 |
# strip out only the path components
|
|
1245 |
got = [x[0] for x in getattr(delta, n)] |
|
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
1246 |
self.assertEqual(expected, got) |
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
1247 |
|
|
2359.1.6
by John Arbash Meinel
Create a helper tree which has a semi-interesting history. |
1248 |
def test_tree_with_single_merge(self): |
1249 |
"""Make sure the tree layout is correct.""" |
|
1250 |
tree = self.create_tree_with_single_merge() |
|
1251 |
rev_A_tree = tree.branch.repository.revision_tree('A') |
|
1252 |
rev_B_tree = tree.branch.repository.revision_tree('B') |
|
1253 |
rev_C_tree = tree.branch.repository.revision_tree('C') |
|
1254 |
rev_D_tree = tree.branch.repository.revision_tree('D') |
|
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
1255 |
|
1256 |
self.check_delta(rev_B_tree.changes_from(rev_A_tree), |
|
1257 |
modified=['f1', 'f3']) |
|
1258 |
||
1259 |
self.check_delta(rev_C_tree.changes_from(rev_A_tree), |
|
1260 |
modified=['f2', 'f3']) |
|
1261 |
||
1262 |
self.check_delta(rev_D_tree.changes_from(rev_B_tree), |
|
1263 |
modified=['f2', 'f3']) |
|
1264 |
||
1265 |
self.check_delta(rev_D_tree.changes_from(rev_C_tree), |
|
1266 |
modified=['f1', 'f3']) |
|
|
2359.1.6
by John Arbash Meinel
Create a helper tree which has a semi-interesting history. |
1267 |
|
|
2359.1.7
by John Arbash Meinel
Create a direct test for _get_revisions_touching_file_id |
1268 |
def assertAllRevisionsForFileID(self, tree, file_id, revisions): |
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
1269 |
"""Ensure _filter_revisions_touching_file_id returns the right values. |
|
2359.1.7
by John Arbash Meinel
Create a direct test for _get_revisions_touching_file_id |
1270 |
|
|
2466.12.1
by Kent Gibson
Fix ``bzr log -r`` to support selecting merge revisions. |
1271 |
Get the return value from _filter_revisions_touching_file_id and make
|
|
2359.1.7
by John Arbash Meinel
Create a direct test for _get_revisions_touching_file_id |
1272 |
sure they are correct.
|
1273 |
"""
|
|
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
1274 |
# The api for _filter_revisions_touching_file_id is a little crazy.
|
|
2359.1.7
by John Arbash Meinel
Create a direct test for _get_revisions_touching_file_id |
1275 |
# So we do the setup here.
|
1276 |
mainline = tree.branch.revision_history() |
|
1277 |
mainline.insert(0, None) |
|
1278 |
revnos = dict((rev, idx+1) for idx, rev in enumerate(mainline)) |
|
1279 |
view_revs_iter = log.get_view_revisions(mainline, revnos, tree.branch, |
|
1280 |
'reverse', True) |
|
|
2466.12.1
by Kent Gibson
Fix ``bzr log -r`` to support selecting merge revisions. |
1281 |
actual_revs = log._filter_revisions_touching_file_id( |
|
3711.3.23
by John Arbash Meinel
Documentation and cleanup. |
1282 |
tree.branch, |
|
2466.12.1
by Kent Gibson
Fix ``bzr log -r`` to support selecting merge revisions. |
1283 |
file_id, |
|
3842.2.5
by Vincent Ladeuil
Better fix for bug #300055. |
1284 |
list(view_revs_iter)) |
|
2359.1.7
by John Arbash Meinel
Create a direct test for _get_revisions_touching_file_id |
1285 |
self.assertEqual(revisions, [r for r, revno, depth in actual_revs]) |
1286 |
||
1287 |
def test_file_id_f1(self): |
|
1288 |
tree = self.create_tree_with_single_merge() |
|
1289 |
# f1 should be marked as modified by revisions A and B
|
|
1290 |
self.assertAllRevisionsForFileID(tree, 'f1-id', ['B', 'A']) |
|
1291 |
||
1292 |
def test_file_id_f2(self): |
|
1293 |
tree = self.create_tree_with_single_merge() |
|
1294 |
# f2 should be marked as modified by revisions A, C, and D
|
|
1295 |
# because D merged the changes from C.
|
|
1296 |
self.assertAllRevisionsForFileID(tree, 'f2-id', ['D', 'C', 'A']) |
|
1297 |
||
1298 |
def test_file_id_f3(self): |
|
1299 |
tree = self.create_tree_with_single_merge() |
|
1300 |
# f3 should be marked as modified by revisions A, B, C, and D
|
|
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
1301 |
self.assertAllRevisionsForFileID(tree, 'f3-id', ['D', 'C', 'B', 'A']) |
|
1551.17.2
by Aaron Bentley
Stop showing deltas in pull -v output |
1302 |
|
|
3373.2.1
by John Arbash Meinel
Fix bug #209948, properly skip over ghosts when displaying the changes for a single file. |
1303 |
def test_file_id_with_ghosts(self): |
1304 |
# This is testing bug #209948, where having a ghost would cause
|
|
1305 |
# _filter_revisions_touching_file_id() to fail.
|
|
1306 |
tree = self.create_tree_with_single_merge() |
|
1307 |
# We need to add a revision, so switch back to a write-locked tree
|
|
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
1308 |
# (still a single addCleanup(tree.unlock) pending).
|
|
3373.2.1
by John Arbash Meinel
Fix bug #209948, properly skip over ghosts when displaying the changes for a single file. |
1309 |
tree.unlock() |
1310 |
tree.lock_write() |
|
1311 |
first_parent = tree.last_revision() |
|
1312 |
tree.set_parent_ids([first_parent, 'ghost-revision-id']) |
|
1313 |
self.build_tree_contents([('tree/f1', 'A\nB\nXX\n')]) |
|
1314 |
tree.commit('commit with a ghost', rev_id='XX') |
|
1315 |
self.assertAllRevisionsForFileID(tree, 'f1-id', ['XX', 'B', 'A']) |
|
1316 |
self.assertAllRevisionsForFileID(tree, 'f2-id', ['D', 'C', 'A']) |
|
1317 |
||
|
4183.3.1
by Vincent Ladeuil
Fix bug #346431 by allowing log._filter_revisions_touching_file_id to be |
1318 |
def test_unknown_file_id(self): |
1319 |
tree = self.create_tree_with_single_merge() |
|
1320 |
self.assertAllRevisionsForFileID(tree, 'unknown', []) |
|
1321 |
||
1322 |
def test_empty_branch_unknown_file_id(self): |
|
1323 |
tree = self.make_branch_and_tree('tree') |
|
1324 |
self.assertAllRevisionsForFileID(tree, 'unknown', []) |
|
1325 |
||
|
1551.17.2
by Aaron Bentley
Stop showing deltas in pull -v output |
1326 |
|
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
1327 |
class TestShowChangedRevisions(tests.TestCaseWithTransport): |
|
1551.17.2
by Aaron Bentley
Stop showing deltas in pull -v output |
1328 |
|
1329 |
def test_show_changed_revisions_verbose(self): |
|
1330 |
tree = self.make_branch_and_tree('tree_a') |
|
1331 |
self.build_tree(['tree_a/foo']) |
|
1332 |
tree.add('foo') |
|
1333 |
tree.commit('bar', rev_id='bar-id') |
|
|
2717.1.1
by Lukáš Lalinsky
Use UTF-8 encoded StringIO for log tests to avoid failures on non-ASCII committer names. |
1334 |
s = self.make_utf8_encoded_stringio() |
|
1551.17.2
by Aaron Bentley
Stop showing deltas in pull -v output |
1335 |
log.show_changed_revisions(tree.branch, [], ['bar-id'], s) |
1336 |
self.assertContainsRe(s.getvalue(), 'bar') |
|
1337 |
self.assertNotContainsRe(s.getvalue(), 'foo') |
|
|
2671.5.8
by Lukáš Lalinsky
Add tests for LogFormatter.short_committer and LogFormatter.short_author. |
1338 |
|
1339 |
||
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
1340 |
class TestLogFormatter(tests.TestCase): |
|
2671.5.8
by Lukáš Lalinsky
Add tests for LogFormatter.short_committer and LogFormatter.short_author. |
1341 |
|
1342 |
def test_short_committer(self): |
|
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
1343 |
rev = revision.Revision('a-id') |
|
2671.5.8
by Lukáš Lalinsky
Add tests for LogFormatter.short_committer and LogFormatter.short_author. |
1344 |
rev.committer = 'John Doe <jdoe@example.com>' |
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
1345 |
lf = log.LogFormatter(None) |
|
2671.5.8
by Lukáš Lalinsky
Add tests for LogFormatter.short_committer and LogFormatter.short_author. |
1346 |
self.assertEqual('John Doe', lf.short_committer(rev)) |
|
3063.3.1
by Lukáš Lalinský
Fall back to showing e-mail in ``log --short/--line`` if the committer/author has only e-mail. |
1347 |
rev.committer = 'John Smith <jsmith@example.com>' |
|
3063.3.3
by Lukáš Lalinský
Add one more test for config.parse_username(). |
1348 |
self.assertEqual('John Smith', lf.short_committer(rev)) |
|
3063.3.1
by Lukáš Lalinský
Fall back to showing e-mail in ``log --short/--line`` if the committer/author has only e-mail. |
1349 |
rev.committer = 'John Smith' |
|
3063.3.3
by Lukáš Lalinský
Add one more test for config.parse_username(). |
1350 |
self.assertEqual('John Smith', lf.short_committer(rev)) |
|
3063.3.1
by Lukáš Lalinský
Fall back to showing e-mail in ``log --short/--line`` if the committer/author has only e-mail. |
1351 |
rev.committer = 'jsmith@example.com' |
|
3063.3.3
by Lukáš Lalinský
Add one more test for config.parse_username(). |
1352 |
self.assertEqual('jsmith@example.com', lf.short_committer(rev)) |
|
3063.3.1
by Lukáš Lalinský
Fall back to showing e-mail in ``log --short/--line`` if the committer/author has only e-mail. |
1353 |
rev.committer = '<jsmith@example.com>' |
|
3063.3.3
by Lukáš Lalinský
Add one more test for config.parse_username(). |
1354 |
self.assertEqual('jsmith@example.com', lf.short_committer(rev)) |
1355 |
rev.committer = 'John Smith jsmith@example.com' |
|
1356 |
self.assertEqual('John Smith', lf.short_committer(rev)) |
|
|
2671.5.8
by Lukáš Lalinsky
Add tests for LogFormatter.short_committer and LogFormatter.short_author. |
1357 |
|
1358 |
def test_short_author(self): |
|
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
1359 |
rev = revision.Revision('a-id') |
|
2671.5.8
by Lukáš Lalinsky
Add tests for LogFormatter.short_committer and LogFormatter.short_author. |
1360 |
rev.committer = 'John Doe <jdoe@example.com>' |
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
1361 |
lf = log.LogFormatter(None) |
|
2671.5.8
by Lukáš Lalinsky
Add tests for LogFormatter.short_committer and LogFormatter.short_author. |
1362 |
self.assertEqual('John Doe', lf.short_author(rev)) |
1363 |
rev.properties['author'] = 'John Smith <jsmith@example.com>' |
|
1364 |
self.assertEqual('John Smith', lf.short_author(rev)) |
|
|
3063.3.1
by Lukáš Lalinský
Fall back to showing e-mail in ``log --short/--line`` if the committer/author has only e-mail. |
1365 |
rev.properties['author'] = 'John Smith' |
1366 |
self.assertEqual('John Smith', lf.short_author(rev)) |
|
1367 |
rev.properties['author'] = 'jsmith@example.com' |
|
1368 |
self.assertEqual('jsmith@example.com', lf.short_author(rev)) |
|
1369 |
rev.properties['author'] = '<jsmith@example.com>' |
|
1370 |
self.assertEqual('jsmith@example.com', lf.short_author(rev)) |
|
|
3063.3.3
by Lukáš Lalinský
Add one more test for config.parse_username(). |
1371 |
rev.properties['author'] = 'John Smith jsmith@example.com' |
1372 |
self.assertEqual('John Smith', lf.short_author(rev)) |
|
|
4056.2.3
by James Westby
Use a new "authors" revision property to allow multiple authors |
1373 |
del rev.properties['author'] |
1374 |
rev.properties['authors'] = ('John Smith <jsmith@example.com>\n' |
|
1375 |
'Jane Rey <jrey@example.com>') |
|
1376 |
self.assertEqual('John Smith', lf.short_author(rev)) |
|
|
3842.2.2
by Vincent Ladeuil
Reproduce bug #300055. |
1377 |
|
1378 |
||
1379 |
class TestReverseByDepth(tests.TestCase): |
|
1380 |
"""Test reverse_by_depth behavior. |
|
1381 |
||
1382 |
This is used to present revisions in forward (oldest first) order in a nice
|
|
1383 |
layout.
|
|
1384 |
||
1385 |
The tests use lighter revision description to ease reading.
|
|
1386 |
"""
|
|
1387 |
||
1388 |
def assertReversed(self, forward, backward): |
|
1389 |
# Transform the descriptions to suit the API: tests use (revno, depth),
|
|
1390 |
# while the API expects (revid, revno, depth)
|
|
1391 |
def complete_revisions(l): |
|
1392 |
"""Transform the description to suit the API. |
|
1393 |
||
1394 |
Tests use (revno, depth) whil the API expects (revid, revno, depth).
|
|
1395 |
Since the revid is arbitrary, we just duplicate revno
|
|
1396 |
"""
|
|
1397 |
return [ (r, r, d) for r, d in l] |
|
1398 |
forward = complete_revisions(forward) |
|
1399 |
backward= complete_revisions(backward) |
|
1400 |
self.assertEqual(forward, log.reverse_by_depth(backward)) |
|
1401 |
||
1402 |
||
1403 |
def test_mainline_revisions(self): |
|
1404 |
self.assertReversed([( '1', 0), ('2', 0)], |
|
1405 |
[('2', 0), ('1', 0)]) |
|
1406 |
||
1407 |
def test_merged_revisions(self): |
|
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
1408 |
self.assertReversed([('1', 0), ('2', 0), ('2.2', 1), ('2.1', 1),], |
1409 |
[('2', 0), ('2.1', 1), ('2.2', 1), ('1', 0),]) |
|
|
3842.2.2
by Vincent Ladeuil
Reproduce bug #300055. |
1410 |
def test_shifted_merged_revisions(self): |
1411 |
"""Test irregular layout. |
|
1412 |
||
1413 |
Requesting revisions touching a file can produce "holes" in the depths.
|
|
1414 |
"""
|
|
1415 |
self.assertReversed([('1', 0), ('2', 0), ('1.1', 2), ('1.2', 2),], |
|
1416 |
[('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. |
1417 |
|
1418 |
def test_merged_without_child_revisions(self): |
|
1419 |
"""Test irregular layout. |
|
1420 |
||
1421 |
Revision ranges can produce "holes" in the depths.
|
|
1422 |
"""
|
|
1423 |
# When a revision of higher depth doesn't follow one of lower depth, we
|
|
1424 |
# assume a lower depth one is virtually there
|
|
1425 |
self.assertReversed([('1', 2), ('2', 2), ('3', 3), ('4', 4)], |
|
1426 |
[('4', 4), ('3', 3), ('2', 2), ('1', 2),]) |
|
1427 |
# So we get the same order after reversing below even if the original
|
|
1428 |
# revisions are not in the same order.
|
|
1429 |
self.assertReversed([('1', 2), ('2', 2), ('3', 3), ('4', 4)], |
|
1430 |
[('3', 3), ('4', 4), ('2', 2), ('1', 2),]) |
|
|
3848.1.6
by Aaron Bentley
Implement get_history_change |
1431 |
|
1432 |
||
|
3848.1.8
by Aaron Bentley
Implement basic show_branch_change |
1433 |
class TestHistoryChange(tests.TestCaseWithTransport): |
|
3848.1.6
by Aaron Bentley
Implement get_history_change |
1434 |
|
1435 |
def setup_a_tree(self): |
|
1436 |
tree = self.make_branch_and_tree('tree') |
|
1437 |
tree.lock_write() |
|
1438 |
self.addCleanup(tree.unlock) |
|
1439 |
tree.commit('1a', rev_id='1a') |
|
1440 |
tree.commit('2a', rev_id='2a') |
|
1441 |
tree.commit('3a', rev_id='3a') |
|
1442 |
return tree |
|
1443 |
||
1444 |
def setup_ab_tree(self): |
|
1445 |
tree = self.setup_a_tree() |
|
1446 |
tree.set_last_revision('1a') |
|
1447 |
tree.branch.set_last_revision_info(1, '1a') |
|
1448 |
tree.commit('2b', rev_id='2b') |
|
1449 |
tree.commit('3b', rev_id='3b') |
|
1450 |
return tree |
|
1451 |
||
1452 |
def setup_ac_tree(self): |
|
1453 |
tree = self.setup_a_tree() |
|
1454 |
tree.set_last_revision(revision.NULL_REVISION) |
|
1455 |
tree.branch.set_last_revision_info(0, revision.NULL_REVISION) |
|
1456 |
tree.commit('1c', rev_id='1c') |
|
1457 |
tree.commit('2c', rev_id='2c') |
|
1458 |
tree.commit('3c', rev_id='3c') |
|
1459 |
return tree |
|
1460 |
||
1461 |
def test_all_new(self): |
|
1462 |
tree = self.setup_ab_tree() |
|
|
3848.1.7
by Aaron Bentley
Use repository in get_history_change |
1463 |
old, new = log.get_history_change('1a', '3a', tree.branch.repository) |
|
3848.1.6
by Aaron Bentley
Implement get_history_change |
1464 |
self.assertEqual([], old) |
1465 |
self.assertEqual(['2a', '3a'], new) |
|
1466 |
||
1467 |
def test_all_old(self): |
|
1468 |
tree = self.setup_ab_tree() |
|
|
3848.1.7
by Aaron Bentley
Use repository in get_history_change |
1469 |
old, new = log.get_history_change('3a', '1a', tree.branch.repository) |
|
3848.1.6
by Aaron Bentley
Implement get_history_change |
1470 |
self.assertEqual([], new) |
1471 |
self.assertEqual(['2a', '3a'], old) |
|
1472 |
||
1473 |
def test_null_old(self): |
|
1474 |
tree = self.setup_ab_tree() |
|
1475 |
old, new = log.get_history_change(revision.NULL_REVISION, |
|
|
3848.1.7
by Aaron Bentley
Use repository in get_history_change |
1476 |
'3a', tree.branch.repository) |
|
3848.1.6
by Aaron Bentley
Implement get_history_change |
1477 |
self.assertEqual([], old) |
1478 |
self.assertEqual(['1a', '2a', '3a'], new) |
|
1479 |
||
1480 |
def test_null_new(self): |
|
1481 |
tree = self.setup_ab_tree() |
|
|
3848.1.7
by Aaron Bentley
Use repository in get_history_change |
1482 |
old, new = log.get_history_change('3a', revision.NULL_REVISION, |
1483 |
tree.branch.repository) |
|
|
3848.1.6
by Aaron Bentley
Implement get_history_change |
1484 |
self.assertEqual([], new) |
1485 |
self.assertEqual(['1a', '2a', '3a'], old) |
|
1486 |
||
1487 |
def test_diverged(self): |
|
1488 |
tree = self.setup_ab_tree() |
|
|
3848.1.7
by Aaron Bentley
Use repository in get_history_change |
1489 |
old, new = log.get_history_change('3a', '3b', tree.branch.repository) |
|
3848.1.6
by Aaron Bentley
Implement get_history_change |
1490 |
self.assertEqual(old, ['2a', '3a']) |
1491 |
self.assertEqual(new, ['2b', '3b']) |
|
1492 |
||
1493 |
def test_unrelated(self): |
|
1494 |
tree = self.setup_ac_tree() |
|
|
3848.1.7
by Aaron Bentley
Use repository in get_history_change |
1495 |
old, new = log.get_history_change('3a', '3c', tree.branch.repository) |
|
3848.1.6
by Aaron Bentley
Implement get_history_change |
1496 |
self.assertEqual(old, ['1a', '2a', '3a']) |
1497 |
self.assertEqual(new, ['1c', '2c', '3c']) |
|
|
3848.1.8
by Aaron Bentley
Implement basic show_branch_change |
1498 |
|
1499 |
def test_show_branch_change(self): |
|
1500 |
tree = self.setup_ab_tree() |
|
1501 |
s = StringIO() |
|
|
3848.1.12
by Aaron Bentley
Fix test parameter order |
1502 |
log.show_branch_change(tree.branch, s, 3, '3a') |
|
3848.1.8
by Aaron Bentley
Implement basic show_branch_change |
1503 |
self.assertContainsRe(s.getvalue(), |
1504 |
'[*]{60}\nRemoved Revisions:\n(.|\n)*2a(.|\n)*3a(.|\n)*' |
|
1505 |
'[*]{60}\n\nAdded Revisions:\n(.|\n)*2b(.|\n)*3b') |
|
1506 |
||
1507 |
def test_show_branch_change_no_change(self): |
|
1508 |
tree = self.setup_ab_tree() |
|
1509 |
s = StringIO() |
|
|
3848.1.12
by Aaron Bentley
Fix test parameter order |
1510 |
log.show_branch_change(tree.branch, s, 3, '3b') |
|
3848.1.8
by Aaron Bentley
Implement basic show_branch_change |
1511 |
self.assertEqual(s.getvalue(), |
1512 |
'Nothing seems to have changed\n') |
|
1513 |
||
|
3848.1.9
by Aaron Bentley
new/old sections are omitted as appropriate. |
1514 |
def test_show_branch_change_no_old(self): |
1515 |
tree = self.setup_ab_tree() |
|
1516 |
s = StringIO() |
|
|
3848.1.12
by Aaron Bentley
Fix test parameter order |
1517 |
log.show_branch_change(tree.branch, s, 2, '2b') |
|
3848.1.9
by Aaron Bentley
new/old sections are omitted as appropriate. |
1518 |
self.assertContainsRe(s.getvalue(), 'Added Revisions:') |
1519 |
self.assertNotContainsRe(s.getvalue(), 'Removed Revisions:') |
|
1520 |
||
1521 |
def test_show_branch_change_no_new(self): |
|
1522 |
tree = self.setup_ab_tree() |
|
1523 |
tree.branch.set_last_revision_info(2, '2b') |
|
1524 |
s = StringIO() |
|
|
3848.1.12
by Aaron Bentley
Fix test parameter order |
1525 |
log.show_branch_change(tree.branch, s, 3, '3b') |
|
3848.1.9
by Aaron Bentley
new/old sections are omitted as appropriate. |
1526 |
self.assertContainsRe(s.getvalue(), 'Removed Revisions:') |
1527 |
self.assertNotContainsRe(s.getvalue(), 'Added Revisions:') |
|
|
4921.2.1
by Neil Martinsen-Burrell
include bug fixes in log output |
1528 |
|
1529 |
||
1530 |
||
1531 |
class TestLogWithBugs(TestCaseForLogFormatter): |
|
1532 |
||
1533 |
def setUp(self): |
|
1534 |
TestCaseForLogFormatter.setUp(self) |
|
1535 |
log.properties_handler_registry.register( |
|
1536 |
'bugs_properties_handler', |
|
1537 |
log._bugs_properties_handler) |
|
1538 |
||
|
4921.2.2
by Neil Martinsen-Burrell
from review comments: improve splitting, add test that handler is present, use build_tree in tests |
1539 |
def make_commits_with_bugs(self): |
1540 |
"""Helper method for LogFormatter tests""" |
|
1541 |
tree = self.make_branch_and_tree(u'.') |
|
1542 |
self.build_tree(['a', 'b']) |
|
1543 |
tree.add('a') |
|
1544 |
tree.commit('simple log message', rev_id='a1', |
|
1545 |
timestamp=1132586655.459960938, timezone=-6*3600, |
|
1546 |
committer='Joe Foo <joe@foo.com>', |
|
1547 |
revprops={'bugs': 'test://bug/id fixed'}) |
|
1548 |
tree.add('b') |
|
1549 |
tree.commit('multiline\nlog\nmessage\n', rev_id='a2', |
|
1550 |
timestamp=1132586842.411175966, timezone=-6*3600, |
|
1551 |
committer='Joe Foo <joe@foo.com>', |
|
1552 |
authors=['Joe Bar <joe@bar.com>'], |
|
1553 |
revprops={'bugs': 'test://bug/id fixed\n' |
|
1554 |
'test://bug/2 fixed'}) |
|
1555 |
return tree |
|
1556 |
||
1557 |
||
|
4921.2.1
by Neil Martinsen-Burrell
include bug fixes in log output |
1558 |
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 |
1559 |
tree = self.make_commits_with_bugs() |
|
4921.2.1
by Neil Martinsen-Burrell
include bug fixes in log output |
1560 |
self.assertFormatterResult("""\ |
1561 |
------------------------------------------------------------
|
|
1562 |
revno: 2
|
|
1563 |
fixes bug(s): test://bug/id test://bug/2
|
|
1564 |
author: Joe Bar <joe@bar.com>
|
|
1565 |
committer: Joe Foo <joe@foo.com>
|
|
1566 |
branch nick: work
|
|
1567 |
timestamp: Mon 2005-11-21 09:27:22 -0600
|
|
1568 |
message:
|
|
1569 |
multiline
|
|
1570 |
log
|
|
1571 |
message
|
|
1572 |
------------------------------------------------------------
|
|
1573 |
revno: 1
|
|
1574 |
fixes bug(s): test://bug/id
|
|
1575 |
committer: Joe Foo <joe@foo.com>
|
|
1576 |
branch nick: work
|
|
1577 |
timestamp: Mon 2005-11-21 09:24:15 -0600
|
|
1578 |
message:
|
|
1579 |
simple log message
|
|
1580 |
""", |
|
1581 |
tree.branch, log.LongLogFormatter) |
|
1582 |
||
1583 |
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 |
1584 |
tree = self.make_commits_with_bugs() |
|
4921.2.1
by Neil Martinsen-Burrell
include bug fixes in log output |
1585 |
self.assertFormatterResult("""\ |
1586 |
2 Joe Bar\t2005-11-21 |
|
1587 |
fixes bug(s): test://bug/id test://bug/2
|
|
1588 |
multiline
|
|
1589 |
log
|
|
1590 |
message
|
|
1591 |
||
1592 |
1 Joe Foo\t2005-11-21 |
|
1593 |
fixes bug(s): test://bug/id
|
|
1594 |
simple log message
|
|
1595 |
||
1596 |
""", |
|
1597 |
tree.branch, log.ShortLogFormatter) |
|
1598 |
||
1599 |
def test_wrong_bugs_property(self): |
|
1600 |
tree = self.make_branch_and_tree(u'.') |
|
1601 |
self.build_tree(['foo']) |
|
1602 |
tree.commit('simple log message', rev_id='a1', |
|
1603 |
timestamp=1132586655.459960938, timezone=-6*3600, |
|
1604 |
committer='Joe Foo <joe@foo.com>', |
|
1605 |
revprops={'bugs': 'test://bug/id invalid_value'}) |
|
1606 |
self.assertFormatterResult("""\ |
|
1607 |
1 Joe Foo\t2005-11-21 |
|
1608 |
simple log message
|
|
1609 |
||
1610 |
""", |
|
1611 |
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 |
1612 |
|
1613 |
def test_bugs_handler_present(self): |
|
1614 |
self.properties_handler_registry.get('bugs_properties_handler') |