4988.10.3
by John Arbash Meinel
Merge bzr.dev 5007, resolve conflict, update NEWS |
1 |
# Copyright (C) 2006-2010 Canonical Ltd
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
2 |
#
|
1540.2.6
by Robey Pointer
make 'log' and 'status' treat '-r N..' as implicitly '-r N..-1' |
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.
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
7 |
#
|
1540.2.6
by Robey Pointer
make 'log' and 'status' treat '-r N..' as implicitly '-r N..-1' |
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.
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
12 |
#
|
1540.2.6
by Robey Pointer
make 'log' and 'status' treat '-r N..' as implicitly '-r N..-1' |
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
|
1540.2.6
by Robey Pointer
make 'log' and 'status' treat '-r N..' as implicitly '-r N..-1' |
16 |
|
17 |
||
1624.1.3
by Robert Collins
Convert log to use the new tsort.merge_sort routine. |
18 |
"""Black-box tests for bzr log."""
|
1540.2.6
by Robey Pointer
make 'log' and 'status' treat '-r N..' as implicitly '-r N..-1' |
19 |
|
4955.4.11
by Vincent Ladeuil
Give some tests a better focus and simplify them accordingly. |
20 |
from itertools import izip |
4325.4.3
by Vincent Ladeuil
More cleanups. |
21 |
import os |
1540.2.6
by Robey Pointer
make 'log' and 'status' treat '-r N..' as implicitly '-r N..-1' |
22 |
|
4325.4.3
by Vincent Ladeuil
More cleanups. |
23 |
from bzrlib import ( |
4955.4.6
by Vincent Ladeuil
Switch to branchbuilder to avoid the cost of test.script. |
24 |
branchbuilder, |
4955.7.3
by Vincent Ladeuil
Check ancestry so we don't output random revisions. |
25 |
errors, |
4955.5.2
by Vincent Ladeuil
Simplify tests. |
26 |
log, |
4325.4.3
by Vincent Ladeuil
More cleanups. |
27 |
osutils, |
28 |
tests, |
|
2978.6.1
by Kent Gibson
Use normalize_log to more accurately test blackbox log output. |
29 |
)
|
4955.4.5
by Vincent Ladeuil
Start reproducing the problems reported in the bug. |
30 |
from bzrlib.tests import ( |
31 |
test_log, |
|
5971.1.49
by Jonathan Riddell
import features in test |
32 |
features, |
4955.4.5
by Vincent Ladeuil
Start reproducing the problems reported in the bug. |
33 |
)
|
3144.7.9
by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors |
34 |
|
35 |
||
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
36 |
class TestLog(tests.TestCaseWithTransport, test_log.TestLogMixin): |
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
37 |
|
38 |
def make_minimal_branch(self, path='.', format=None): |
|
39 |
tree = self.make_branch_and_tree(path, format=format) |
|
40 |
self.build_tree([path + '/hello.txt']) |
|
41 |
tree.add('hello.txt') |
|
42 |
tree.commit(message='message1') |
|
43 |
return tree |
|
44 |
||
45 |
def make_linear_branch(self, path='.', format=None): |
|
2809.1.2
by Daniel Watkins
Removed unnecessary check as per abentley's on-list comments. |
46 |
tree = self.make_branch_and_tree(path, format=format) |
2664.14.1
by Daniel Watkins
Fixed tests.blackbox.test_log to use internals where appropriate. |
47 |
self.build_tree( |
48 |
[path + '/hello.txt', path + '/goodbye.txt', path + '/meep.txt']) |
|
49 |
tree.add('hello.txt') |
|
50 |
tree.commit(message='message1') |
|
51 |
tree.add('goodbye.txt') |
|
52 |
tree.commit(message='message2') |
|
53 |
tree.add('meep.txt') |
|
54 |
tree.commit(message='message3') |
|
55 |
return tree |
|
1553.4.2
by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure |
56 |
|
4369.2.1
by Marius Kruger
add some leftover log tests |
57 |
def make_merged_branch(self, path='.', format=None): |
4369.2.2
by Marius Kruger
use make_linear_branch in make_merged_branch |
58 |
tree = self.make_linear_branch(path, format) |
59 |
tree2 = tree.bzrdir.sprout('tree2', |
|
60 |
revision_id=tree.branch.get_rev_id(1)).open_workingtree() |
|
4369.2.1
by Marius Kruger
add some leftover log tests |
61 |
tree2.commit(message='tree2 message2') |
62 |
tree2.commit(message='tree2 message3') |
|
63 |
tree.merge_from_branch(tree2.branch) |
|
64 |
tree.commit(message='merge') |
|
65 |
return tree |
|
66 |
||
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
67 |
|
4955.5.2
by Vincent Ladeuil
Simplify tests. |
68 |
class TestLogWithLogCatcher(TestLog): |
69 |
||
70 |
def setUp(self): |
|
71 |
super(TestLogWithLogCatcher, self).setUp() |
|
5340.12.14
by Martin
Revert changes to bb.test_log which caused some failures |
72 |
# Capture log formatter creations
|
4955.5.2
by Vincent Ladeuil
Simplify tests. |
73 |
class MyLogFormatter(test_log.LogCatcher): |
74 |
||
5340.12.14
by Martin
Revert changes to bb.test_log which caused some failures |
75 |
def __new__(klass, *args, **kwargs): |
76 |
self.log_catcher = test_log.LogCatcher(*args, **kwargs) |
|
77 |
# Always return our own log formatter
|
|
78 |
return self.log_catcher |
|
5340.15.1
by John Arbash Meinel
supersede exc-info branch |
79 |
# Break cycle with closure over self on cleanup by removing method
|
80 |
self.addCleanup(setattr, MyLogFormatter, "__new__", None) |
|
4955.5.2
by Vincent Ladeuil
Simplify tests. |
81 |
|
82 |
def getme(branch): |
|
83 |
# Always return our own log formatter class hijacking the
|
|
84 |
# default behavior (which requires setting up a config
|
|
85 |
# variable)
|
|
86 |
return MyLogFormatter |
|
4985.1.5
by Vincent Ladeuil
Deploying the new overrideAttr facility further reduces the complexity |
87 |
self.overrideAttr(log.log_formatter_registry, 'get_default', getme) |
4955.5.2
by Vincent Ladeuil
Simplify tests. |
88 |
|
4955.4.8
by Vincent Ladeuil
Simplify more tests. |
89 |
def get_captured_revisions(self): |
5340.12.14
by Martin
Revert changes to bb.test_log which caused some failures |
90 |
return self.log_catcher.revisions |
4955.4.8
by Vincent Ladeuil
Simplify more tests. |
91 |
|
6123.11.10
by Martin von Gagern
Print deprecation warnings for all uses of include_merges. |
92 |
def assertLogRevnos(self, args, expected_revnos, working_dir='.', |
93 |
out='', err=''): |
|
94 |
actual_out, actual_err = self.run_bzr(['log'] + args, |
|
95 |
working_dir=working_dir) |
|
96 |
self.assertEqual(out, actual_out) |
|
97 |
self.assertEqual(err, actual_err) |
|
4955.4.8
by Vincent Ladeuil
Simplify more tests. |
98 |
self.assertEqual(expected_revnos, |
99 |
[r.revno for r in self.get_captured_revisions()]) |
|
100 |
||
101 |
def assertLogRevnosAndDepths(self, args, expected_revnos_and_depths, |
|
102 |
working_dir='.'): |
|
103 |
self.run_bzr(['log'] + args, working_dir=working_dir) |
|
104 |
self.assertEqual(expected_revnos_and_depths, |
|
105 |
[(r.revno, r.merge_depth) |
|
106 |
for r in self.get_captured_revisions()]) |
|
4955.5.2
by Vincent Ladeuil
Simplify tests. |
107 |
|
108 |
||
109 |
class TestLogRevSpecs(TestLogWithLogCatcher): |
|
110 |
||
111 |
def test_log_no_revspec(self): |
|
112 |
self.make_linear_branch() |
|
113 |
self.assertLogRevnos([], ['3', '2', '1']) |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
114 |
|
1553.4.2
by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure |
115 |
def test_log_null_end_revspec(self): |
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
116 |
self.make_linear_branch() |
4955.5.2
by Vincent Ladeuil
Simplify tests. |
117 |
self.assertLogRevnos(['-r1..'], ['3', '2', '1']) |
1553.4.2
by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure |
118 |
|
119 |
def test_log_null_begin_revspec(self): |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
120 |
self.make_linear_branch() |
4955.5.2
by Vincent Ladeuil
Simplify tests. |
121 |
self.assertLogRevnos(['-r..3'], ['3', '2', '1']) |
1553.4.2
by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure |
122 |
|
123 |
def test_log_null_both_revspecs(self): |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
124 |
self.make_linear_branch() |
4955.5.2
by Vincent Ladeuil
Simplify tests. |
125 |
self.assertLogRevnos(['-r..'], ['3', '2', '1']) |
2978.4.1
by Kent Gibson
Logging revision 0 returns error. |
126 |
|
1553.4.2
by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure |
127 |
def test_log_negative_begin_revspec_full_log(self): |
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
128 |
self.make_linear_branch() |
4955.5.2
by Vincent Ladeuil
Simplify tests. |
129 |
self.assertLogRevnos(['-r-3..'], ['3', '2', '1']) |
1553.4.2
by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure |
130 |
|
131 |
def test_log_negative_both_revspec_full_log(self): |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
132 |
self.make_linear_branch() |
4955.5.2
by Vincent Ladeuil
Simplify tests. |
133 |
self.assertLogRevnos(['-r-3..-1'], ['3', '2', '1']) |
1553.4.2
by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure |
134 |
|
135 |
def test_log_negative_both_revspec_partial(self): |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
136 |
self.make_linear_branch() |
4955.5.2
by Vincent Ladeuil
Simplify tests. |
137 |
self.assertLogRevnos(['-r-3..-2'], ['2', '1']) |
1553.4.2
by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure |
138 |
|
139 |
def test_log_negative_begin_revspec(self): |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
140 |
self.make_linear_branch() |
4955.5.2
by Vincent Ladeuil
Simplify tests. |
141 |
self.assertLogRevnos(['-r-2..'], ['3', '2']) |
1553.4.2
by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure |
142 |
|
2978.4.1
by Kent Gibson
Logging revision 0 returns error. |
143 |
def test_log_positive_revspecs(self): |
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
144 |
self.make_linear_branch() |
4955.5.2
by Vincent Ladeuil
Simplify tests. |
145 |
self.assertLogRevnos(['-r1..3'], ['3', '2', '1']) |
1624.1.3
by Robert Collins
Convert log to use the new tsort.merge_sort routine. |
146 |
|
4369.2.1
by Marius Kruger
add some leftover log tests |
147 |
def test_log_dotted_revspecs(self): |
148 |
self.make_merged_branch() |
|
4955.5.2
by Vincent Ladeuil
Simplify tests. |
149 |
self.assertLogRevnos(['-n0', '-r1..1.1.1'], ['1.1.1', '1']) |
3734.1.1
by Vincent Ladeuil
Fix bug #248427 by adding a --change option to log. |
150 |
|
4955.5.1
by Vincent Ladeuil
Split some tests to better characterize the classes |
151 |
def test_log_limit(self): |
152 |
tree = self.make_branch_and_tree('.') |
|
153 |
# We want more commits than our batch size starts at
|
|
154 |
for pos in range(10): |
|
155 |
tree.commit("%s" % pos) |
|
4955.5.2
by Vincent Ladeuil
Simplify tests. |
156 |
self.assertLogRevnos(['--limit', '2'], ['10', '9']) |
4955.5.1
by Vincent Ladeuil
Split some tests to better characterize the classes |
157 |
|
158 |
def test_log_limit_short(self): |
|
159 |
self.make_linear_branch() |
|
4955.5.2
by Vincent Ladeuil
Simplify tests. |
160 |
self.assertLogRevnos(['-l', '2'], ['3', '2']) |
161 |
||
4955.4.7
by Vincent Ladeuil
Some more cleanup. |
162 |
def test_log_change_revno(self): |
163 |
self.make_linear_branch() |
|
164 |
self.assertLogRevnos(['-c1'], ['1']) |
|
165 |
||
5318.1.2
by Martin von Gagern
Add blackbox test for "bzr log -r branch:../bar". |
166 |
def test_branch_revspec(self): |
167 |
foo = self.make_branch_and_tree('foo') |
|
168 |
bar = self.make_branch_and_tree('bar') |
|
169 |
self.build_tree(['foo/foo.txt', 'bar/bar.txt']) |
|
170 |
foo.add('foo.txt') |
|
171 |
bar.add('bar.txt') |
|
172 |
foo.commit(message='foo') |
|
173 |
bar.commit(message='bar') |
|
174 |
self.run_bzr('log -r branch:../bar', working_dir='foo') |
|
175 |
self.assertEqual([bar.branch.get_rev_id(1)], |
|
176 |
[r.rev.revision_id |
|
177 |
for r in self.get_captured_revisions()]) |
|
178 |
||
4955.4.6
by Vincent Ladeuil
Switch to branchbuilder to avoid the cost of test.script. |
179 |
|
5268.4.1
by Vincent Ladeuil
Failing test for bug #575631. |
180 |
class TestLogExcludeCommonAncestry(TestLogWithLogCatcher): |
181 |
||
182 |
def test_exclude_common_ancestry_simple_revnos(self): |
|
183 |
self.make_linear_branch() |
|
184 |
self.assertLogRevnos(['-r1..3', '--exclude-common-ancestry'], |
|
185 |
['3', '2']) |
|
186 |
||
187 |
||
4955.7.5
by Vincent Ladeuil
Fixed as per Ian's review. |
188 |
class TestLogMergedLinearAncestry(TestLogWithLogCatcher): |
4955.4.5
by Vincent Ladeuil
Start reproducing the problems reported in the bug. |
189 |
|
190 |
def setUp(self): |
|
4955.7.5
by Vincent Ladeuil
Fixed as per Ian's review. |
191 |
super(TestLogMergedLinearAncestry, self).setUp() |
4955.4.6
by Vincent Ladeuil
Switch to branchbuilder to avoid the cost of test.script. |
192 |
# FIXME: Using a MemoryTree would be even better here (but until we
|
193 |
# stop calling run_bzr, there is no point) --vila 100118.
|
|
194 |
builder = branchbuilder.BranchBuilder(self.get_transport()) |
|
195 |
builder.start_series() |
|
5268.4.1
by Vincent Ladeuil
Failing test for bug #575631. |
196 |
# 1
|
197 |
# | \
|
|
198 |
# 2 1.1.1
|
|
199 |
# | / |
|
|
200 |
# 3 1.1.2
|
|
201 |
# | |
|
|
202 |
# | 1.1.3
|
|
203 |
# | / |
|
|
204 |
# 4 1.1.4
|
|
205 |
# | /
|
|
206 |
# 5
|
|
207 |
||
4955.4.6
by Vincent Ladeuil
Switch to branchbuilder to avoid the cost of test.script. |
208 |
# mainline
|
209 |
builder.build_snapshot('1', None, [ |
|
210 |
('add', ('', 'root-id', 'directory', ''))]) |
|
211 |
builder.build_snapshot('2', ['1'], []) |
|
212 |
# branch
|
|
213 |
builder.build_snapshot('1.1.1', ['1'], []) |
|
214 |
# merge branch into mainline
|
|
215 |
builder.build_snapshot('3', ['2', '1.1.1'], []) |
|
216 |
# new commits in branch
|
|
217 |
builder.build_snapshot('1.1.2', ['1.1.1'], []) |
|
218 |
builder.build_snapshot('1.1.3', ['1.1.2'], []) |
|
219 |
# merge branch into mainline
|
|
220 |
builder.build_snapshot('4', ['3', '1.1.3'], []) |
|
221 |
# merge mainline into branch
|
|
222 |
builder.build_snapshot('1.1.4', ['1.1.3', '4'], []) |
|
223 |
# merge branch into mainline
|
|
224 |
builder.build_snapshot('5', ['4', '1.1.4'], []) |
|
225 |
builder.finish_series() |
|
4955.4.5
by Vincent Ladeuil
Start reproducing the problems reported in the bug. |
226 |
|
227 |
def test_n0(self): |
|
228 |
self.assertLogRevnos(['-n0', '-r1.1.1..1.1.4'], |
|
229 |
['1.1.4', '4', '1.1.3', '1.1.2', '3', '1.1.1']) |
|
230 |
def test_n0_forward(self): |
|
231 |
self.assertLogRevnos(['-n0', '-r1.1.1..1.1.4', '--forward'], |
|
232 |
['3', '1.1.1', '4', '1.1.2', '1.1.3', '1.1.4']) |
|
233 |
||
234 |
def test_n1(self): |
|
4955.4.6
by Vincent Ladeuil
Switch to branchbuilder to avoid the cost of test.script. |
235 |
# starting from 1.1.4 we follow the left-hand ancestry
|
4955.4.5
by Vincent Ladeuil
Start reproducing the problems reported in the bug. |
236 |
self.assertLogRevnos(['-n1', '-r1.1.1..1.1.4'], |
237 |
['1.1.4', '1.1.3', '1.1.2', '1.1.1']) |
|
238 |
||
239 |
def test_n1_forward(self): |
|
240 |
self.assertLogRevnos(['-n1', '-r1.1.1..1.1.4', '--forward'], |
|
241 |
['1.1.1', '1.1.2', '1.1.3', '1.1.4']) |
|
242 |
||
4955.5.2
by Vincent Ladeuil
Simplify tests. |
243 |
|
4955.7.5
by Vincent Ladeuil
Fixed as per Ian's review. |
244 |
class Test_GenerateAllRevisions(TestLogWithLogCatcher): |
4955.7.3
by Vincent Ladeuil
Check ancestry so we don't output random revisions. |
245 |
|
5092.1.1
by Vincent Ladeuil
Reproduce bug #519862. |
246 |
def setUp(self): |
247 |
super(Test_GenerateAllRevisions, self).setUp() |
|
248 |
builder = self.make_branch_with_many_merges() |
|
249 |
b = builder.get_branch() |
|
250 |
b.lock_read() |
|
251 |
self.addCleanup(b.unlock) |
|
252 |
self.branch = b |
|
253 |
||
4955.7.5
by Vincent Ladeuil
Fixed as per Ian's review. |
254 |
def make_branch_with_many_merges(self, path='.', format=None): |
4955.7.3
by Vincent Ladeuil
Check ancestry so we don't output random revisions. |
255 |
builder = branchbuilder.BranchBuilder(self.get_transport()) |
256 |
builder.start_series() |
|
257 |
# The graph below may look a bit complicated (and it may be but I've
|
|
258 |
# banged my head enough on it) but the bug requires at least dotted
|
|
259 |
# revnos *and* merged revisions below that.
|
|
260 |
builder.build_snapshot('1', None, [ |
|
261 |
('add', ('', 'root-id', 'directory', ''))]) |
|
262 |
builder.build_snapshot('2', ['1'], []) |
|
263 |
builder.build_snapshot('1.1.1', ['1'], []) |
|
264 |
builder.build_snapshot('2.1.1', ['2'], []) |
|
265 |
builder.build_snapshot('3', ['2', '1.1.1'], []) |
|
266 |
builder.build_snapshot('2.1.2', ['2.1.1'], []) |
|
267 |
builder.build_snapshot('2.2.1', ['2.1.1'], []) |
|
268 |
builder.build_snapshot('2.1.3', ['2.1.2', '2.2.1'], []) |
|
269 |
builder.build_snapshot('4', ['3', '2.1.3'], []) |
|
270 |
builder.build_snapshot('5', ['4', '2.1.2'], []) |
|
271 |
builder.finish_series() |
|
272 |
return builder |
|
273 |
||
274 |
def test_not_an_ancestor(self): |
|
275 |
self.assertRaises(errors.BzrCommandError, |
|
276 |
log._generate_all_revisions, |
|
5092.1.1
by Vincent Ladeuil
Reproduce bug #519862. |
277 |
self.branch, '1.1.1', '2.1.3', 'reverse', |
4955.7.3
by Vincent Ladeuil
Check ancestry so we don't output random revisions. |
278 |
delayed_graph_generation=True) |
279 |
||
280 |
def test_wrong_order(self): |
|
281 |
self.assertRaises(errors.BzrCommandError, |
|
282 |
log._generate_all_revisions, |
|
5092.1.1
by Vincent Ladeuil
Reproduce bug #519862. |
283 |
self.branch, '5', '2.1.3', 'reverse', |
4955.7.3
by Vincent Ladeuil
Check ancestry so we don't output random revisions. |
284 |
delayed_graph_generation=True) |
285 |
||
5092.1.1
by Vincent Ladeuil
Reproduce bug #519862. |
286 |
def test_no_start_rev_id_with_end_rev_id_being_a_merge(self): |
287 |
revs = log._generate_all_revisions( |
|
288 |
self.branch, None, '2.1.3', |
|
289 |
'reverse', delayed_graph_generation=True) |
|
290 |
||
4955.7.3
by Vincent Ladeuil
Check ancestry so we don't output random revisions. |
291 |
|
4955.5.2
by Vincent Ladeuil
Simplify tests. |
292 |
class TestLogRevSpecsWithPaths(TestLogWithLogCatcher): |
293 |
||
294 |
def test_log_revno_n_path_wrong_namespace(self): |
|
295 |
self.make_linear_branch('branch1') |
|
296 |
self.make_linear_branch('branch2') |
|
297 |
# There is no guarantee that a path exist between two arbitrary
|
|
298 |
# revisions.
|
|
299 |
self.run_bzr("log -r revno:2:branch1..revno:3:branch2", retcode=3) |
|
300 |
||
301 |
def test_log_revno_n_path_correct_order(self): |
|
302 |
self.make_linear_branch('branch2') |
|
303 |
self.assertLogRevnos(['-rrevno:1:branch2..revno:3:branch2'], |
|
304 |
['3', '2','1']) |
|
305 |
||
306 |
def test_log_revno_n_path(self): |
|
307 |
self.make_linear_branch('branch2') |
|
308 |
self.assertLogRevnos(['-rrevno:1:branch2'], |
|
309 |
['1']) |
|
310 |
rev_props = self.log_catcher.revisions[0].rev.properties |
|
311 |
self.assertEqual('branch2', rev_props['branch-nick']) |
|
4955.5.1
by Vincent Ladeuil
Split some tests to better characterize the classes |
312 |
|
313 |
||
314 |
class TestLogErrors(TestLog): |
|
315 |
||
4955.5.2
by Vincent Ladeuil
Simplify tests. |
316 |
def test_log_zero_revspec(self): |
317 |
self.make_minimal_branch() |
|
318 |
self.run_bzr_error(['bzr: ERROR: Logging revision 0 is invalid.'], |
|
319 |
['log', '-r0']) |
|
320 |
||
321 |
def test_log_zero_begin_revspec(self): |
|
322 |
self.make_linear_branch() |
|
323 |
self.run_bzr_error(['bzr: ERROR: Logging revision 0 is invalid.'], |
|
324 |
['log', '-r0..2']) |
|
325 |
||
326 |
def test_log_zero_end_revspec(self): |
|
327 |
self.make_linear_branch() |
|
328 |
self.run_bzr_error(['bzr: ERROR: Logging revision 0 is invalid.'], |
|
329 |
['log', '-r-2..0']) |
|
330 |
||
3878.3.3
by Marius Kruger
Add tests for log -r with non-exising revno's |
331 |
def test_log_nonexistent_revno(self): |
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
332 |
self.make_minimal_branch() |
5105.1.4
by Vincent Ladeuil
Use single quotes so that no test need to be updated. |
333 |
self.run_bzr_error(["bzr: ERROR: Requested revision: '1234' " |
4955.4.7
by Vincent Ladeuil
Some more cleanup. |
334 |
"does not exist in branch:"], |
335 |
['log', '-r1234']) |
|
3878.3.3
by Marius Kruger
Add tests for log -r with non-exising revno's |
336 |
|
337 |
def test_log_nonexistent_dotted_revno(self): |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
338 |
self.make_minimal_branch() |
5105.1.4
by Vincent Ladeuil
Use single quotes so that no test need to be updated. |
339 |
self.run_bzr_error(["bzr: ERROR: Requested revision: '123.123' " |
4955.4.7
by Vincent Ladeuil
Some more cleanup. |
340 |
"does not exist in branch:"], |
341 |
['log', '-r123.123']) |
|
3734.1.1
by Vincent Ladeuil
Fix bug #248427 by adding a --change option to log. |
342 |
|
3878.3.2
by Marius Kruger
Add tests for log -c with non-exising revno's |
343 |
def test_log_change_nonexistent_revno(self): |
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
344 |
self.make_minimal_branch() |
5105.1.4
by Vincent Ladeuil
Use single quotes so that no test need to be updated. |
345 |
self.run_bzr_error(["bzr: ERROR: Requested revision: '1234' " |
4955.4.7
by Vincent Ladeuil
Some more cleanup. |
346 |
"does not exist in branch:"], |
347 |
['log', '-c1234']) |
|
3878.3.2
by Marius Kruger
Add tests for log -c with non-exising revno's |
348 |
|
349 |
def test_log_change_nonexistent_dotted_revno(self): |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
350 |
self.make_minimal_branch() |
5105.1.4
by Vincent Ladeuil
Use single quotes so that no test need to be updated. |
351 |
self.run_bzr_error(["bzr: ERROR: Requested revision: '123.123' " |
4955.4.7
by Vincent Ladeuil
Some more cleanup. |
352 |
"does not exist in branch:"], |
353 |
['log', '-c123.123']) |
|
3878.3.2
by Marius Kruger
Add tests for log -c with non-exising revno's |
354 |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
355 |
def test_log_change_single_revno_only(self): |
356 |
self.make_minimal_branch() |
|
4325.4.6
by Vincent Ladeuil
Fixed as per John's and Markus reviews. |
357 |
self.run_bzr_error(['bzr: ERROR: Option --change does not' |
358 |
' accept revision ranges'], |
|
3734.1.1
by Vincent Ladeuil
Fix bug #248427 by adding a --change option to log. |
359 |
['log', '--change', '2..3']) |
360 |
||
361 |
def test_log_change_incompatible_with_revision(self): |
|
4325.4.6
by Vincent Ladeuil
Fixed as per John's and Markus reviews. |
362 |
self.run_bzr_error(['bzr: ERROR: --revision and --change' |
363 |
' are mutually exclusive'], |
|
3734.1.1
by Vincent Ladeuil
Fix bug #248427 by adding a --change option to log. |
364 |
['log', '--change', '2', '--revision', '3']) |
365 |
||
2100.1.1
by wang
Running ``bzr log`` on nonexistent file gives an error instead of the |
366 |
def test_log_nonexistent_file(self): |
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
367 |
self.make_minimal_branch() |
2100.1.1
by wang
Running ``bzr log`` on nonexistent file gives an error instead of the |
368 |
# files that don't exist in either the basis tree or working tree
|
369 |
# should give an error
|
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
370 |
out, err = self.run_bzr('log does-not-exist', retcode=3) |
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
371 |
self.assertContainsRe(err, |
372 |
'Path unknown at end or start of revision range: '
|
|
373 |
'does-not-exist') |
|
2388.1.11
by Alexander Belchenko
changes after John's review |
374 |
|
4955.5.2
by Vincent Ladeuil
Simplify tests. |
375 |
def test_log_reversed_revspecs(self): |
376 |
self.make_linear_branch() |
|
377 |
self.run_bzr_error(('bzr: ERROR: Start revision must be older than ' |
|
378 |
'the end revision.\n',), |
|
379 |
['log', '-r3..1']) |
|
380 |
||
381 |
def test_log_reversed_dotted_revspecs(self): |
|
382 |
self.make_merged_branch() |
|
383 |
self.run_bzr_error(('bzr: ERROR: Start revision not found in ' |
|
384 |
'left-hand history of end revision.\n',), |
|
385 |
"log -r 1.1.1..1") |
|
386 |
||
4955.5.1
by Vincent Ladeuil
Split some tests to better characterize the classes |
387 |
def test_log_bad_message_re(self): |
388 |
"""Bad --message argument gives a sensible message
|
|
5326.2.1
by Parth Malwankar
added InvalidPattern error. |
389 |
|
4955.5.1
by Vincent Ladeuil
Split some tests to better characterize the classes |
390 |
See https://bugs.launchpad.net/bzr/+bug/251352
|
391 |
"""
|
|
392 |
self.make_minimal_branch() |
|
393 |
out, err = self.run_bzr(['log', '-m', '*'], retcode=3) |
|
5326.2.1
by Parth Malwankar
added InvalidPattern error. |
394 |
self.assertContainsRe(err, "ERROR.*Invalid pattern.*nothing to repeat") |
5339.1.1
by Parth Malwankar
fixes errors.InvalidPattern to work on Python2.5 |
395 |
self.assertNotContainsRe(err, "Unprintable exception") |
5326.2.1
by Parth Malwankar
added InvalidPattern error. |
396 |
self.assertEqual(out, '') |
4955.5.1
by Vincent Ladeuil
Split some tests to better characterize the classes |
397 |
|
4955.4.7
by Vincent Ladeuil
Some more cleanup. |
398 |
def test_log_unsupported_timezone(self): |
399 |
self.make_linear_branch() |
|
400 |
self.run_bzr_error(['bzr: ERROR: Unsupported timezone format "foo", ' |
|
401 |
'options are "utc", "original", "local".'], |
|
402 |
['log', '--timezone', 'foo']) |
|
4955.5.1
by Vincent Ladeuil
Split some tests to better characterize the classes |
403 |
|
5097.1.13
by Vincent Ladeuil
Add more tests. |
404 |
def test_log_exclude_ancestry_no_range(self): |
405 |
self.make_linear_branch() |
|
406 |
self.run_bzr_error(['bzr: ERROR: --exclude-common-ancestry' |
|
407 |
' requires -r with two revisions'], |
|
408 |
['log', '--exclude-common-ancestry']) |
|
409 |
||
410 |
def test_log_exclude_ancestry_single_revision(self): |
|
411 |
self.make_merged_branch() |
|
412 |
self.run_bzr_error(['bzr: ERROR: --exclude-common-ancestry' |
|
413 |
' requires two different revisions'], |
|
414 |
['log', '--exclude-common-ancestry', |
|
415 |
'-r1.1.1..1.1.1']) |
|
4955.5.1
by Vincent Ladeuil
Split some tests to better characterize the classes |
416 |
|
417 |
class TestLogTags(TestLog): |
|
418 |
||
2388.1.3
by Erik Bagfors
tests for tags in log output |
419 |
def test_log_with_tags(self): |
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
420 |
tree = self.make_linear_branch(format='dirstate-tags') |
2664.14.1
by Daniel Watkins
Fixed tests.blackbox.test_log to use internals where appropriate. |
421 |
branch = tree.branch |
422 |
branch.tags.set_tag('tag1', branch.get_rev_id(1)) |
|
423 |
branch.tags.set_tag('tag1.1', branch.get_rev_id(1)) |
|
3842.2.5
by Vincent Ladeuil
Better fix for bug #300055. |
424 |
branch.tags.set_tag('tag3', branch.last_revision()) |
425 |
||
2530.3.1
by Martin Pool
Cleanup old variations on run_bzr in the test suite |
426 |
log = self.run_bzr("log -r-1")[0] |
2388.1.3
by Erik Bagfors
tests for tags in log output |
427 |
self.assertTrue('tags: tag3' in log) |
428 |
||
2530.3.1
by Martin Pool
Cleanup old variations on run_bzr in the test suite |
429 |
log = self.run_bzr("log -r1")[0] |
2388.1.3
by Erik Bagfors
tests for tags in log output |
430 |
# I guess that we can't know the order of tags in the output
|
431 |
# since dicts are unordered, need to check both possibilities
|
|
2388.1.11
by Alexander Belchenko
changes after John's review |
432 |
self.assertContainsRe(log, r'tags: (tag1, tag1\.1|tag1\.1, tag1)') |
433 |
||
2388.1.9
by Erik Bagfors
test for merges with tags in log |
434 |
def test_merged_log_with_tags(self): |
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
435 |
branch1_tree = self.make_linear_branch('branch1', |
436 |
format='dirstate-tags') |
|
2664.14.1
by Daniel Watkins
Fixed tests.blackbox.test_log to use internals where appropriate. |
437 |
branch1 = branch1_tree.branch |
438 |
branch2_tree = branch1_tree.bzrdir.sprout('branch2').open_workingtree() |
|
439 |
branch1_tree.commit(message='foobar', allow_pointless=True) |
|
440 |
branch1.tags.set_tag('tag1', branch1.last_revision()) |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
441 |
# tags don't propagate if we don't merge
|
442 |
self.run_bzr('merge ../branch1', working_dir='branch2') |
|
2664.14.1
by Daniel Watkins
Fixed tests.blackbox.test_log to use internals where appropriate. |
443 |
branch2_tree.commit(message='merge branch 1') |
4511.3.11
by Marius Kruger
* fix tests again |
444 |
log = self.run_bzr("log -n0 -r-1", working_dir='branch2')[0] |
2388.1.11
by Alexander Belchenko
changes after John's review |
445 |
self.assertContainsRe(log, r' tags: tag1') |
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
446 |
log = self.run_bzr("log -n0 -r3.1.1", working_dir='branch2')[0] |
2466.12.2
by Kent Gibson
shift log output with only merge revisions to the left margin |
447 |
self.assertContainsRe(log, r'tags: tag1') |
2388.1.3
by Erik Bagfors
tests for tags in log output |
448 |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
449 |
|
5971.1.44
by Jonathan Riddell
add testcase for --signatures |
450 |
class TestLogSignatures(TestLog): |
451 |
||
452 |
def test_log_with_signatures(self): |
|
453 |
self.requireFeature(features.gpgme) |
|
454 |
||
455 |
tree = self.make_linear_branch(format='dirstate-tags') |
|
456 |
||
457 |
log = self.run_bzr("log --signatures")[0] |
|
458 |
self.assertTrue('signature: no signature' in log) |
|
459 |
||
460 |
def test_log_without_signatures(self): |
|
461 |
self.requireFeature(features.gpgme) |
|
462 |
||
463 |
tree = self.make_linear_branch(format='dirstate-tags') |
|
464 |
||
465 |
log = self.run_bzr("log")[0] |
|
466 |
self.assertFalse('signature: no signature' in log) |
|
467 |
||
468 |
||
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
469 |
class TestLogVerbose(TestLog): |
3874.1.8
by Vincent Ladeuil
Fixed as ber Robert's review. |
470 |
|
471 |
def setUp(self): |
|
472 |
super(TestLogVerbose, self).setUp() |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
473 |
self.make_minimal_branch() |
3874.1.8
by Vincent Ladeuil
Fixed as ber Robert's review. |
474 |
|
475 |
def assertUseShortDeltaFormat(self, cmd): |
|
476 |
log = self.run_bzr(cmd)[0] |
|
477 |
# Check that we use the short status format
|
|
3947.1.7
by Ian Clatworthy
tweak indenting/offsetting for --short given dotted revno lengths |
478 |
self.assertContainsRe(log, '(?m)^\s*A hello.txt$') |
479 |
self.assertNotContainsRe(log, '(?m)^\s*added:$') |
|
3874.1.4
by Vincent Ladeuil
Fixed as per Aarons' comment. |
480 |
|
3874.1.8
by Vincent Ladeuil
Fixed as ber Robert's review. |
481 |
def assertUseLongDeltaFormat(self, cmd): |
482 |
log = self.run_bzr(cmd)[0] |
|
483 |
# Check that we use the long status format
|
|
3947.1.7
by Ian Clatworthy
tweak indenting/offsetting for --short given dotted revno lengths |
484 |
self.assertNotContainsRe(log, '(?m)^\s*A hello.txt$') |
485 |
self.assertContainsRe(log, '(?m)^\s*added:$') |
|
3874.1.8
by Vincent Ladeuil
Fixed as ber Robert's review. |
486 |
|
487 |
def test_log_short_verbose(self): |
|
488 |
self.assertUseShortDeltaFormat(['log', '--short', '-v']) |
|
489 |
||
5945.1.3
by Martin von Gagern
Add blackbox tests for -S as an alias to --short. |
490 |
def test_log_s_verbose(self): |
491 |
self.assertUseShortDeltaFormat(['log', '-S', '-v']) |
|
492 |
||
3874.1.4
by Vincent Ladeuil
Fixed as per Aarons' comment. |
493 |
def test_log_short_verbose_verbose(self): |
3874.1.8
by Vincent Ladeuil
Fixed as ber Robert's review. |
494 |
self.assertUseLongDeltaFormat(['log', '--short', '-vv']) |
3874.1.4
by Vincent Ladeuil
Fixed as per Aarons' comment. |
495 |
|
496 |
def test_log_long_verbose(self): |
|
3874.1.7
by Vincent Ladeuil
Restrict '-v' change to log --short only. |
497 |
# Check that we use the long status format, ignoring the verbosity
|
498 |
# level
|
|
3874.1.8
by Vincent Ladeuil
Fixed as ber Robert's review. |
499 |
self.assertUseLongDeltaFormat(['log', '--long', '-v']) |
3874.1.4
by Vincent Ladeuil
Fixed as per Aarons' comment. |
500 |
|
501 |
def test_log_long_verbose_verbose(self): |
|
3874.1.7
by Vincent Ladeuil
Restrict '-v' change to log --short only. |
502 |
# Check that we use the long status format, ignoring the verbosity
|
503 |
# level
|
|
3874.1.8
by Vincent Ladeuil
Fixed as ber Robert's review. |
504 |
self.assertUseLongDeltaFormat(['log', '--long', '-vv']) |
3874.1.1
by Vincent Ladeuil
Fix #87179 by using the short status format when the short format is used for log. |
505 |
|
3144.7.9
by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors |
506 |
|
4955.4.8
by Vincent Ladeuil
Simplify more tests. |
507 |
class TestLogMerges(TestLogWithLogCatcher): |
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
508 |
|
509 |
def setUp(self): |
|
510 |
super(TestLogMerges, self).setUp() |
|
511 |
self.make_branches_with_merges() |
|
512 |
||
513 |
def make_branches_with_merges(self): |
|
514 |
level0 = self.make_branch_and_tree('level0') |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
515 |
self.wt_commit(level0, 'in branch level0') |
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
516 |
level1 = level0.bzrdir.sprout('level1').open_workingtree() |
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
517 |
self.wt_commit(level1, 'in branch level1') |
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
518 |
level2 = level1.bzrdir.sprout('level2').open_workingtree() |
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
519 |
self.wt_commit(level2, 'in branch level2') |
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
520 |
level1.merge_from_branch(level2.branch) |
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
521 |
self.wt_commit(level1, 'merge branch level2') |
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
522 |
level0.merge_from_branch(level1.branch) |
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
523 |
self.wt_commit(level0, 'merge branch level1') |
3947.1.3
by Ian Clatworthy
blackbox tests |
524 |
|
2466.12.1
by Kent Gibson
Fix ``bzr log -r`` to support selecting merge revisions. |
525 |
def test_merges_are_indented_by_level(self): |
4955.4.8
by Vincent Ladeuil
Simplify more tests. |
526 |
self.run_bzr(['log', '-n0'], working_dir='level0') |
527 |
revnos_and_depth = [(r.revno, r.merge_depth) |
|
528 |
for r in self.get_captured_revisions()] |
|
529 |
self.assertEqual([('2', 0), ('1.1.2', 1), ('1.2.1', 2), ('1.1.1', 1), |
|
530 |
('1', 0)], |
|
531 |
[(r.revno, r.merge_depth) |
|
532 |
for r in self.get_captured_revisions()]) |
|
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
533 |
|
3947.1.3
by Ian Clatworthy
blackbox tests |
534 |
def test_force_merge_revisions_off(self): |
4955.4.8
by Vincent Ladeuil
Simplify more tests. |
535 |
self.assertLogRevnos(['-n1'], ['2', '1'], working_dir='level0') |
3947.1.3
by Ian Clatworthy
blackbox tests |
536 |
|
537 |
def test_force_merge_revisions_on(self): |
|
4955.4.8
by Vincent Ladeuil
Simplify more tests. |
538 |
self.assertLogRevnos(['-n0'], ['2', '1.1.2', '1.2.1', '1.1.1', '1'], |
539 |
working_dir='level0') |
|
3947.1.7
by Ian Clatworthy
tweak indenting/offsetting for --short given dotted revno lengths |
540 |
|
4221.2.1
by Ian Clatworthy
--include-merges as an alias for --levels 0 in log |
541 |
def test_include_merges(self): |
542 |
# Confirm --include-merges gives the same output as -n0
|
|
6123.11.10
by Martin von Gagern
Print deprecation warnings for all uses of include_merges. |
543 |
msg = ("The option '--include-merges' to 'bzr log' " |
544 |
"has been deprecated in bzr 2.5. "
|
|
6123.11.13
by Martin von Gagern
Rename --include-sidelines to --include-merged. |
545 |
"Please use '--include-merged' instead.\n") |
6123.11.10
by Martin von Gagern
Print deprecation warnings for all uses of include_merges. |
546 |
self.assertLogRevnos(['--include-merges'], |
547 |
['2', '1.1.2', '1.2.1', '1.1.1', '1'], |
|
548 |
working_dir='level0', err=msg) |
|
549 |
self.assertLogRevnos(['--include-merges'], |
|
550 |
['2', '1.1.2', '1.2.1', '1.1.1', '1'], |
|
551 |
working_dir='level0', err=msg) |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
552 |
out_im, err_im = self.run_bzr('log --include-merges', |
553 |
working_dir='level0') |
|
554 |
out_n0, err_n0 = self.run_bzr('log -n0', working_dir='level0') |
|
6123.11.10
by Martin von Gagern
Print deprecation warnings for all uses of include_merges. |
555 |
self.assertEqual(msg, err_im) |
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
556 |
self.assertEqual('', err_n0) |
4221.2.1
by Ian Clatworthy
--include-merges as an alias for --levels 0 in log |
557 |
self.assertEqual(out_im, out_n0) |
558 |
||
6123.11.13
by Martin von Gagern
Rename --include-sidelines to --include-merged. |
559 |
def test_include_merged(self): |
560 |
# Confirm --include-merged gives the same output as -n0
|
|
6123.11.6
by Vincent Ladeuil
Add new paraneters add signature's ends, fix a test and a typo, check that no errors and no output is emitted when using assertLogRevnos. |
561 |
expected = ['2', '1.1.2', '1.2.1', '1.1.1', '1'] |
6123.11.13
by Martin von Gagern
Rename --include-sidelines to --include-merged. |
562 |
self.assertLogRevnos(['--include-merged'], |
6123.11.6
by Vincent Ladeuil
Add new paraneters add signature's ends, fix a test and a typo, check that no errors and no output is emitted when using assertLogRevnos. |
563 |
expected, working_dir='level0') |
6123.11.13
by Martin von Gagern
Rename --include-sidelines to --include-merged. |
564 |
self.assertLogRevnos(['--include-merged'], |
6123.11.6
by Vincent Ladeuil
Add new paraneters add signature's ends, fix a test and a typo, check that no errors and no output is emitted when using assertLogRevnos. |
565 |
expected, working_dir='level0') |
6123.11.3
by Martin von Gagern
Add blackbox test for --include-sidelines option. |
566 |
|
3947.1.7
by Ian Clatworthy
tweak indenting/offsetting for --short given dotted revno lengths |
567 |
def test_force_merge_revisions_N(self): |
4955.4.8
by Vincent Ladeuil
Simplify more tests. |
568 |
self.assertLogRevnos(['-n2'], |
569 |
['2', '1.1.2', '1.1.1', '1'], |
|
570 |
working_dir='level0') |
|
3947.1.3
by Ian Clatworthy
blackbox tests |
571 |
|
2466.12.1
by Kent Gibson
Fix ``bzr log -r`` to support selecting merge revisions. |
572 |
def test_merges_single_merge_rev(self): |
4955.4.8
by Vincent Ladeuil
Simplify more tests. |
573 |
self.assertLogRevnosAndDepths(['-n0', '-r1.1.2'], |
574 |
[('1.1.2', 0), ('1.2.1', 1)], |
|
575 |
working_dir='level0') |
|
2466.12.1
by Kent Gibson
Fix ``bzr log -r`` to support selecting merge revisions. |
576 |
|
577 |
def test_merges_partial_range(self): |
|
4955.4.8
by Vincent Ladeuil
Simplify more tests. |
578 |
self.assertLogRevnosAndDepths( |
579 |
['-n0', '-r1.1.1..1.1.2'], |
|
580 |
[('1.1.2', 0), ('1.2.1', 1), ('1.1.1', 0)], |
|
581 |
working_dir='level0') |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
582 |
|
4511.3.1
by Marius Kruger
add test_merges_partial_range_ignore_before_lower_bound |
583 |
def test_merges_partial_range_ignore_before_lower_bound(self): |
4511.3.11
by Marius Kruger
* fix tests again |
584 |
"""Dont show revisions before the lower bound's merged revs"""
|
4955.4.8
by Vincent Ladeuil
Simplify more tests. |
585 |
self.assertLogRevnosAndDepths( |
586 |
['-n0', '-r1.1.2..2'], |
|
587 |
[('2', 0), ('1.1.2', 1), ('1.2.1', 2)], |
|
588 |
working_dir='level0') |
|
4511.3.1
by Marius Kruger
add test_merges_partial_range_ignore_before_lower_bound |
589 |
|
6123.11.4
by Martin von Gagern
Introduce an option "--omit-merges" for "bzr log". |
590 |
def test_omit_merges_with_sidelines(self): |
591 |
self.assertLogRevnos(['--omit-merges', '-n0'], ['1.2.1', '1.1.1', '1'], |
|
592 |
working_dir='level0') |
|
593 |
||
594 |
def test_omit_merges_without_sidelines(self): |
|
595 |
self.assertLogRevnos(['--omit-merges', '-n1'], ['1'], |
|
596 |
working_dir='level0') |
|
597 |
||
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
598 |
|
4955.4.11
by Vincent Ladeuil
Give some tests a better focus and simplify them accordingly. |
599 |
class TestLogDiff(TestLogWithLogCatcher): |
600 |
||
601 |
# FIXME: We need specific tests for each LogFormatter about how the diffs
|
|
602 |
# are displayed: --long indent them by depth, --short use a fixed
|
|
603 |
# indent and --line does't display them. -- vila 10019
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
604 |
|
605 |
def setUp(self): |
|
606 |
super(TestLogDiff, self).setUp() |
|
607 |
self.make_branch_with_diffs() |
|
608 |
||
609 |
def make_branch_with_diffs(self): |
|
610 |
level0 = self.make_branch_and_tree('level0') |
|
611 |
self.build_tree(['level0/file1', 'level0/file2']) |
|
612 |
level0.add('file1') |
|
613 |
level0.add('file2') |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
614 |
self.wt_commit(level0, 'in branch level0') |
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
615 |
|
616 |
level1 = level0.bzrdir.sprout('level1').open_workingtree() |
|
617 |
self.build_tree_contents([('level1/file2', 'hello\n')]) |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
618 |
self.wt_commit(level1, 'in branch level1') |
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
619 |
level0.merge_from_branch(level1.branch) |
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
620 |
self.wt_commit(level0, 'merge branch level1') |
3943.5.3
by Ian Clatworthy
add tests |
621 |
|
4955.4.11
by Vincent Ladeuil
Give some tests a better focus and simplify them accordingly. |
622 |
def _diff_file1_revno1(self): |
623 |
return """=== added file 'file1' |
|
4325.4.6
by Vincent Ladeuil
Fixed as per John's and Markus reviews. |
624 |
--- file1\t1970-01-01 00:00:00 +0000 |
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
625 |
+++ file1\t2005-11-22 00:00:00 +0000 |
3943.5.6
by Ian Clatworthy
feedback from jam's review |
626 |
@@ -0,0 +1,1 @@
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
627 |
+contents of level0/file1
|
3943.5.6
by Ian Clatworthy
feedback from jam's review |
628 |
|
4955.4.11
by Vincent Ladeuil
Give some tests a better focus and simplify them accordingly. |
629 |
"""
|
630 |
||
631 |
def _diff_file2_revno2(self): |
|
632 |
return """=== modified file 'file2' |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
633 |
--- file2\t2005-11-22 00:00:00 +0000 |
634 |
+++ file2\t2005-11-22 00:00:01 +0000 |
|
4955.4.11
by Vincent Ladeuil
Give some tests a better focus and simplify them accordingly. |
635 |
@@ -1,1 +1,1 @@
|
636 |
-contents of level0/file2
|
|
637 |
+hello
|
|
638 |
||
639 |
"""
|
|
640 |
||
641 |
def _diff_file2_revno1_1_1(self): |
|
642 |
return """=== modified file 'file2' |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
643 |
--- file2\t2005-11-22 00:00:00 +0000 |
644 |
+++ file2\t2005-11-22 00:00:01 +0000 |
|
4955.4.11
by Vincent Ladeuil
Give some tests a better focus and simplify them accordingly. |
645 |
@@ -1,1 +1,1 @@
|
646 |
-contents of level0/file2
|
|
647 |
+hello
|
|
648 |
||
649 |
"""
|
|
650 |
||
651 |
def _diff_file2_revno1(self): |
|
652 |
return """=== added file 'file2' |
|
4325.4.6
by Vincent Ladeuil
Fixed as per John's and Markus reviews. |
653 |
--- file2\t1970-01-01 00:00:00 +0000 |
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
654 |
+++ file2\t2005-11-22 00:00:00 +0000 |
3943.5.6
by Ian Clatworthy
feedback from jam's review |
655 |
@@ -0,0 +1,1 @@
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
656 |
+contents of level0/file2
|
4955.4.11
by Vincent Ladeuil
Give some tests a better focus and simplify them accordingly. |
657 |
|
658 |
"""
|
|
659 |
||
4955.4.13
by Vincent Ladeuil
Remove dead code. |
660 |
def assertLogRevnosAndDiff(self, args, expected, |
4955.4.11
by Vincent Ladeuil
Give some tests a better focus and simplify them accordingly. |
661 |
working_dir='.'): |
662 |
self.run_bzr(['log', '-p'] + args, working_dir=working_dir) |
|
663 |
expected_revnos_and_depths = [ |
|
664 |
(revno, depth) for revno, depth, diff in expected] |
|
665 |
# Check the revnos and depths first to make debugging easier
|
|
666 |
self.assertEqual(expected_revnos_and_depths, |
|
667 |
[(r.revno, r.merge_depth) |
|
668 |
for r in self.get_captured_revisions()]) |
|
669 |
# Now check the diffs, adding the revno in case of failure
|
|
670 |
fmt = 'In revno %s\n%s' |
|
671 |
for expected_rev, actual_rev in izip(expected, |
|
672 |
self.get_captured_revisions()): |
|
673 |
revno, depth, expected_diff = expected_rev |
|
674 |
actual_diff = actual_rev.diff |
|
675 |
self.assertEqualDiff(fmt % (revno, expected_diff), |
|
676 |
fmt % (revno, actual_diff)) |
|
677 |
||
678 |
def test_log_diff_with_merges(self): |
|
4955.4.13
by Vincent Ladeuil
Remove dead code. |
679 |
self.assertLogRevnosAndDiff( |
680 |
['-n0'], |
|
681 |
[('2', 0, self._diff_file2_revno2()), |
|
682 |
('1.1.1', 1, self._diff_file2_revno1_1_1()), |
|
683 |
('1', 0, self._diff_file1_revno1() |
|
684 |
+ self._diff_file2_revno1())], |
|
685 |
working_dir='level0') |
|
4955.4.11
by Vincent Ladeuil
Give some tests a better focus and simplify them accordingly. |
686 |
|
687 |
||
688 |
def test_log_diff_file1(self): |
|
4955.4.13
by Vincent Ladeuil
Remove dead code. |
689 |
self.assertLogRevnosAndDiff(['-n0', 'file1'], |
690 |
[('1', 0, self._diff_file1_revno1())], |
|
691 |
working_dir='level0') |
|
4955.4.11
by Vincent Ladeuil
Give some tests a better focus and simplify them accordingly. |
692 |
|
693 |
def test_log_diff_file2(self): |
|
4955.4.13
by Vincent Ladeuil
Remove dead code. |
694 |
self.assertLogRevnosAndDiff(['-n1', 'file2'], |
695 |
[('2', 0, self._diff_file2_revno2()), |
|
696 |
('1', 0, self._diff_file2_revno1())], |
|
697 |
working_dir='level0') |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
698 |
|
699 |
||
700 |
class TestLogUnicodeDiff(TestLog): |
|
3943.5.4
by Ian Clatworthy
filter diff by file |
701 |
|
4110.1.1
by Alexander Belchenko
Fixed problem with `log -p` and non-ascii content of files: show_diff should write the diff to exact [stdout] stream. |
702 |
def test_log_show_diff_non_ascii(self): |
703 |
# Smoke test for bug #328007 UnicodeDecodeError on 'log -p'
|
|
704 |
message = u'Message with \xb5' |
|
705 |
body = 'Body with \xb5\n' |
|
706 |
wt = self.make_branch_and_tree('.') |
|
707 |
self.build_tree_contents([('foo', body)]) |
|
708 |
wt.add('foo') |
|
709 |
wt.commit(message=message) |
|
710 |
# check that command won't fail with unicode error
|
|
711 |
# don't care about exact output because we have other tests for this
|
|
712 |
out,err = self.run_bzr('log -p --long') |
|
713 |
self.assertNotEqual('', out) |
|
714 |
self.assertEqual('', err) |
|
715 |
out,err = self.run_bzr('log -p --short') |
|
716 |
self.assertNotEqual('', out) |
|
717 |
self.assertEqual('', err) |
|
718 |
out,err = self.run_bzr('log -p --line') |
|
719 |
self.assertNotEqual('', out) |
|
720 |
self.assertEqual('', err) |
|
721 |
||
3943.5.3
by Ian Clatworthy
add tests |
722 |
|
4325.4.3
by Vincent Ladeuil
More cleanups. |
723 |
class TestLogEncodings(tests.TestCaseInTempDir): |
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
724 |
|
725 |
_mu = u'\xb5' |
|
726 |
_message = u'Message with \xb5' |
|
727 |
||
728 |
# Encodings which can encode mu
|
|
729 |
good_encodings = [ |
|
730 |
'utf-8', |
|
731 |
'latin-1', |
|
732 |
'iso-8859-1', |
|
733 |
'cp437', # Common windows encoding |
|
4110.1.1
by Alexander Belchenko
Fixed problem with `log -p` and non-ascii content of files: show_diff should write the diff to exact [stdout] stream. |
734 |
'cp1251', # Russian windows encoding |
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
735 |
'cp1258', # Common windows encoding |
736 |
]
|
|
737 |
# Encodings which cannot encode mu
|
|
738 |
bad_encodings = [ |
|
739 |
'ascii', |
|
740 |
'iso-8859-2', |
|
741 |
'koi8_r', |
|
742 |
]
|
|
743 |
||
744 |
def setUp(self): |
|
4325.4.3
by Vincent Ladeuil
More cleanups. |
745 |
super(TestLogEncodings, self).setUp() |
4985.1.5
by Vincent Ladeuil
Deploying the new overrideAttr facility further reduces the complexity |
746 |
self.overrideAttr(osutils, '_cached_user_encoding') |
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
747 |
|
748 |
def create_branch(self): |
|
749 |
bzr = self.run_bzr |
|
750 |
bzr('init') |
|
4955.4.16
by Vincent Ladeuil
Be windows-friendly and don't left opened files behind. |
751 |
self.build_tree_contents([('a', 'some stuff\n')]) |
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
752 |
bzr('add a') |
753 |
bzr(['commit', '-m', self._message]) |
|
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
754 |
|
755 |
def try_encoding(self, encoding, fail=False): |
|
756 |
bzr = self.run_bzr |
|
757 |
if fail: |
|
758 |
self.assertRaises(UnicodeEncodeError, |
|
759 |
self._mu.encode, encoding) |
|
760 |
encoded_msg = self._message.encode(encoding, 'replace') |
|
761 |
else: |
|
762 |
encoded_msg = self._message.encode(encoding) |
|
763 |
||
3224.5.4
by Andrew Bennetts
Fix test suite, mainly weeding out uses of bzrlib.user_encoding. |
764 |
old_encoding = osutils._cached_user_encoding |
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
765 |
# This test requires that 'run_bzr' uses the current
|
766 |
# bzrlib, because we override user_encoding, and expect
|
|
767 |
# it to be used
|
|
768 |
try: |
|
3224.5.4
by Andrew Bennetts
Fix test suite, mainly weeding out uses of bzrlib.user_encoding. |
769 |
osutils._cached_user_encoding = 'ascii' |
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
770 |
# We should be able to handle any encoding
|
771 |
out, err = bzr('log', encoding=encoding) |
|
772 |
if not fail: |
|
773 |
# Make sure we wrote mu as we expected it to exist
|
|
774 |
self.assertNotEqual(-1, out.find(encoded_msg)) |
|
775 |
out_unicode = out.decode(encoding) |
|
776 |
self.assertNotEqual(-1, out_unicode.find(self._message)) |
|
777 |
else: |
|
778 |
self.assertNotEqual(-1, out.find('Message with ?')) |
|
779 |
finally: |
|
3224.5.4
by Andrew Bennetts
Fix test suite, mainly weeding out uses of bzrlib.user_encoding. |
780 |
osutils._cached_user_encoding = old_encoding |
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
781 |
|
782 |
def test_log_handles_encoding(self): |
|
783 |
self.create_branch() |
|
784 |
||
785 |
for encoding in self.good_encodings: |
|
786 |
self.try_encoding(encoding) |
|
787 |
||
788 |
def test_log_handles_bad_encoding(self): |
|
789 |
self.create_branch() |
|
790 |
||
791 |
for encoding in self.bad_encodings: |
|
792 |
self.try_encoding(encoding, fail=True) |
|
793 |
||
794 |
def test_stdout_encoding(self): |
|
795 |
bzr = self.run_bzr |
|
3224.5.4
by Andrew Bennetts
Fix test suite, mainly weeding out uses of bzrlib.user_encoding. |
796 |
osutils._cached_user_encoding = "cp1251" |
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
797 |
|
798 |
bzr('init') |
|
799 |
self.build_tree(['a']) |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
800 |
bzr('add a') |
801 |
bzr(['commit', '-m', u'\u0422\u0435\u0441\u0442']) |
|
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
802 |
stdout, stderr = self.run_bzr('log', encoding='cp866') |
803 |
||
804 |
message = stdout.splitlines()[-1] |
|
805 |
||
806 |
# explanation of the check:
|
|
807 |
# u'\u0422\u0435\u0441\u0442' is word 'Test' in russian
|
|
808 |
# in cp866 encoding this is string '\x92\xa5\xe1\xe2'
|
|
809 |
# in cp1251 encoding this is string '\xd2\xe5\xf1\xf2'
|
|
810 |
# This test should check that output of log command
|
|
811 |
# encoded to sys.stdout.encoding
|
|
812 |
test_in_cp866 = '\x92\xa5\xe1\xe2' |
|
813 |
test_in_cp1251 = '\xd2\xe5\xf1\xf2' |
|
814 |
# Make sure the log string is encoded in cp866
|
|
815 |
self.assertEquals(test_in_cp866, message[2:]) |
|
816 |
# Make sure the cp1251 string is not found anywhere
|
|
817 |
self.assertEquals(-1, stdout.find(test_in_cp1251)) |
|
818 |
||
1551.10.18
by Aaron Bentley
Log works in local treeless branches (#84247) |
819 |
|
4955.4.9
by Vincent Ladeuil
More simplifications. |
820 |
class TestLogFile(TestLogWithLogCatcher): |
1551.10.18
by Aaron Bentley
Log works in local treeless branches (#84247) |
821 |
|
822 |
def test_log_local_branch_file(self): |
|
823 |
"""We should be able to log files in local treeless branches"""
|
|
824 |
tree = self.make_branch_and_tree('tree') |
|
825 |
self.build_tree(['tree/file']) |
|
826 |
tree.add('file') |
|
827 |
tree.commit('revision 1') |
|
828 |
tree.bzrdir.destroy_workingtree() |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
829 |
self.run_bzr('log tree/file') |
2359.1.1
by Kent Gibson
Fix ``bzr log <file>`` so it only logs the revisions that changed the file, and does it faster. |
830 |
|
3943.6.1
by Ian Clatworthy
find file using the end revision |
831 |
def prepare_tree(self, complex=False): |
3943.6.3
by Ian Clatworthy
search the start tree if the end tree doesn't have a file |
832 |
# The complex configuration includes deletes and renames
|
2359.1.1
by Kent Gibson
Fix ``bzr log <file>`` so it only logs the revisions that changed the file, and does it faster. |
833 |
tree = self.make_branch_and_tree('parent') |
834 |
self.build_tree(['parent/file1', 'parent/file2', 'parent/file3']) |
|
835 |
tree.add('file1') |
|
836 |
tree.commit('add file1') |
|
837 |
tree.add('file2') |
|
838 |
tree.commit('add file2') |
|
839 |
tree.add('file3') |
|
840 |
tree.commit('add file3') |
|
2664.14.1
by Daniel Watkins
Fixed tests.blackbox.test_log to use internals where appropriate. |
841 |
child_tree = tree.bzrdir.sprout('child').open_workingtree() |
842 |
self.build_tree_contents([('child/file2', 'hello')]) |
|
843 |
child_tree.commit(message='branch 1') |
|
844 |
tree.merge_from_branch(child_tree.branch) |
|
845 |
tree.commit(message='merge child branch') |
|
3943.6.1
by Ian Clatworthy
find file using the end revision |
846 |
if complex: |
3943.6.3
by Ian Clatworthy
search the start tree if the end tree doesn't have a file |
847 |
tree.remove('file2') |
848 |
tree.commit('remove file2') |
|
849 |
tree.rename_one('file3', 'file4') |
|
850 |
tree.commit('file3 is now called file4') |
|
3943.6.1
by Ian Clatworthy
find file using the end revision |
851 |
tree.remove('file1') |
3943.6.3
by Ian Clatworthy
search the start tree if the end tree doesn't have a file |
852 |
tree.commit('remove file1') |
2359.1.1
by Kent Gibson
Fix ``bzr log <file>`` so it only logs the revisions that changed the file, and does it faster. |
853 |
os.chdir('parent') |
3940.1.2
by Ian Clatworthy
add test |
854 |
|
4955.4.9
by Vincent Ladeuil
More simplifications. |
855 |
# FIXME: It would be good to parametrize the following tests against all
|
856 |
# formatters. But the revisions selection is not *currently* part of the
|
|
857 |
# LogFormatter contract, so using LogCatcher is sufficient -- vila 100118
|
|
858 |
def test_log_file1(self): |
|
859 |
self.prepare_tree() |
|
860 |
self.assertLogRevnos(['-n0', 'file1'], ['1']) |
|
861 |
||
862 |
def test_log_file2(self): |
|
863 |
self.prepare_tree() |
|
864 |
# file2 full history
|
|
865 |
self.assertLogRevnos(['-n0', 'file2'], ['4', '3.1.1', '2']) |
|
866 |
# file2 in a merge revision
|
|
867 |
self.assertLogRevnos(['-n0', '-r3.1.1', 'file2'], ['3.1.1']) |
|
868 |
# file2 in a mainline revision
|
|
869 |
self.assertLogRevnos(['-n0', '-r4', 'file2'], ['4', '3.1.1']) |
|
870 |
# file2 since a revision
|
|
871 |
self.assertLogRevnos(['-n0', '-r3..', 'file2'], ['4', '3.1.1']) |
|
872 |
# file2 up to a revision
|
|
873 |
self.assertLogRevnos(['-n0', '-r..3', 'file2'], ['2']) |
|
874 |
||
875 |
def test_log_file3(self): |
|
876 |
self.prepare_tree() |
|
877 |
self.assertLogRevnos(['-n0', 'file3'], ['3']) |
|
3940.1.2
by Ian Clatworthy
add test |
878 |
|
3943.6.4
by Ian Clatworthy
review feedback from vila |
879 |
def test_log_file_historical_missing(self): |
3943.6.3
by Ian Clatworthy
search the start tree if the end tree doesn't have a file |
880 |
# Check logging a deleted file gives an error if the
|
881 |
# file isn't found at the end or start of the revision range
|
|
3943.6.4
by Ian Clatworthy
review feedback from vila |
882 |
self.prepare_tree(complex=True) |
3943.6.3
by Ian Clatworthy
search the start tree if the end tree doesn't have a file |
883 |
err_msg = "Path unknown at end or start of revision range: file2" |
884 |
err = self.run_bzr('log file2', retcode=3)[1] |
|
3943.6.1
by Ian Clatworthy
find file using the end revision |
885 |
self.assertContainsRe(err, err_msg) |
886 |
||
3943.6.4
by Ian Clatworthy
review feedback from vila |
887 |
def test_log_file_historical_end(self): |
3943.6.3
by Ian Clatworthy
search the start tree if the end tree doesn't have a file |
888 |
# Check logging a deleted file is ok if the file existed
|
889 |
# at the end the revision range
|
|
3943.6.4
by Ian Clatworthy
review feedback from vila |
890 |
self.prepare_tree(complex=True) |
4955.4.9
by Vincent Ladeuil
More simplifications. |
891 |
self.assertLogRevnos(['-n0', '-r..4', 'file2'], ['4', '3.1.1', '2']) |
3943.6.3
by Ian Clatworthy
search the start tree if the end tree doesn't have a file |
892 |
|
3943.6.4
by Ian Clatworthy
review feedback from vila |
893 |
def test_log_file_historical_start(self): |
3943.6.3
by Ian Clatworthy
search the start tree if the end tree doesn't have a file |
894 |
# Check logging a deleted file is ok if the file existed
|
895 |
# at the start of the revision range
|
|
3943.6.4
by Ian Clatworthy
review feedback from vila |
896 |
self.prepare_tree(complex=True) |
4955.4.9
by Vincent Ladeuil
More simplifications. |
897 |
self.assertLogRevnos(['file1'], ['1']) |
3943.6.1
by Ian Clatworthy
find file using the end revision |
898 |
|
899 |
def test_log_file_renamed(self): |
|
3943.6.3
by Ian Clatworthy
search the start tree if the end tree doesn't have a file |
900 |
"""File matched against revision range, not current tree."""
|
3943.6.1
by Ian Clatworthy
find file using the end revision |
901 |
self.prepare_tree(complex=True) |
3943.6.3
by Ian Clatworthy
search the start tree if the end tree doesn't have a file |
902 |
|
3943.6.1
by Ian Clatworthy
find file using the end revision |
903 |
# Check logging a renamed file gives an error by default
|
3943.6.3
by Ian Clatworthy
search the start tree if the end tree doesn't have a file |
904 |
err_msg = "Path unknown at end or start of revision range: file3" |
3943.6.1
by Ian Clatworthy
find file using the end revision |
905 |
err = self.run_bzr('log file3', retcode=3)[1] |
906 |
self.assertContainsRe(err, err_msg) |
|
907 |
||
908 |
# Check we can see a renamed file if we give the right end revision
|
|
4955.4.9
by Vincent Ladeuil
More simplifications. |
909 |
self.assertLogRevnos(['-r..4', 'file3'], ['3']) |
4202.2.1
by Ian Clatworthy
get directory logging working again |
910 |
|
911 |
||
4955.4.10
by Vincent Ladeuil
More simplification. |
912 |
class TestLogMultiple(TestLogWithLogCatcher): |
4202.2.1
by Ian Clatworthy
get directory logging working again |
913 |
|
914 |
def prepare_tree(self): |
|
915 |
tree = self.make_branch_and_tree('parent') |
|
916 |
self.build_tree([ |
|
917 |
'parent/file1', |
|
918 |
'parent/file2', |
|
919 |
'parent/dir1/', |
|
920 |
'parent/dir1/file5', |
|
921 |
'parent/dir1/dir2/', |
|
922 |
'parent/dir1/dir2/file3', |
|
923 |
'parent/file4']) |
|
924 |
tree.add('file1') |
|
4202.2.2
by Ian Clatworthy
improve signal-to-noise ratio in tests |
925 |
tree.commit('add file1') |
4202.2.1
by Ian Clatworthy
get directory logging working again |
926 |
tree.add('file2') |
4202.2.2
by Ian Clatworthy
improve signal-to-noise ratio in tests |
927 |
tree.commit('add file2') |
4202.2.1
by Ian Clatworthy
get directory logging working again |
928 |
tree.add(['dir1', 'dir1/dir2', 'dir1/dir2/file3']) |
4202.2.2
by Ian Clatworthy
improve signal-to-noise ratio in tests |
929 |
tree.commit('add file3') |
4202.2.1
by Ian Clatworthy
get directory logging working again |
930 |
tree.add('file4') |
4202.2.2
by Ian Clatworthy
improve signal-to-noise ratio in tests |
931 |
tree.commit('add file4') |
4202.2.1
by Ian Clatworthy
get directory logging working again |
932 |
tree.add('dir1/file5') |
4202.2.2
by Ian Clatworthy
improve signal-to-noise ratio in tests |
933 |
tree.commit('add file5') |
4202.2.1
by Ian Clatworthy
get directory logging working again |
934 |
child_tree = tree.bzrdir.sprout('child').open_workingtree() |
935 |
self.build_tree_contents([('child/file2', 'hello')]) |
|
4202.2.2
by Ian Clatworthy
improve signal-to-noise ratio in tests |
936 |
child_tree.commit(message='branch 1') |
4202.2.1
by Ian Clatworthy
get directory logging working again |
937 |
tree.merge_from_branch(child_tree.branch) |
4202.2.2
by Ian Clatworthy
improve signal-to-noise ratio in tests |
938 |
tree.commit(message='merge child branch') |
4202.2.1
by Ian Clatworthy
get directory logging working again |
939 |
os.chdir('parent') |
940 |
||
941 |
def test_log_files(self): |
|
942 |
"""The log for multiple file should only list revs for those files"""
|
|
943 |
self.prepare_tree() |
|
4955.4.10
by Vincent Ladeuil
More simplification. |
944 |
self.assertLogRevnos(['file1', 'file2', 'dir1/dir2/file3'], |
945 |
['6', '5.1.1', '3', '2', '1']) |
|
4202.2.1
by Ian Clatworthy
get directory logging working again |
946 |
|
947 |
def test_log_directory(self): |
|
948 |
"""The log for a directory should show all nested files."""
|
|
949 |
self.prepare_tree() |
|
4955.4.10
by Vincent Ladeuil
More simplification. |
950 |
self.assertLogRevnos(['dir1'], ['5', '3']) |
4202.2.1
by Ian Clatworthy
get directory logging working again |
951 |
|
952 |
def test_log_nested_directory(self): |
|
953 |
"""The log for a directory should show all nested files."""
|
|
954 |
self.prepare_tree() |
|
4955.4.10
by Vincent Ladeuil
More simplification. |
955 |
self.assertLogRevnos(['dir1/dir2'], ['3']) |
4202.2.1
by Ian Clatworthy
get directory logging working again |
956 |
|
957 |
def test_log_in_nested_directory(self): |
|
958 |
"""The log for a directory should show all nested files."""
|
|
959 |
self.prepare_tree() |
|
960 |
os.chdir("dir1") |
|
4955.4.10
by Vincent Ladeuil
More simplification. |
961 |
self.assertLogRevnos(['.'], ['5', '3']) |
4202.2.1
by Ian Clatworthy
get directory logging working again |
962 |
|
963 |
def test_log_files_and_directories(self): |
|
964 |
"""Logging files and directories together should be fine."""
|
|
965 |
self.prepare_tree() |
|
4955.4.10
by Vincent Ladeuil
More simplification. |
966 |
self.assertLogRevnos(['file4', 'dir1/dir2'], ['4', '3']) |
4202.2.1
by Ian Clatworthy
get directory logging working again |
967 |
|
968 |
def test_log_files_and_dirs_in_nested_directory(self): |
|
969 |
"""The log for a directory should show all nested files."""
|
|
970 |
self.prepare_tree() |
|
971 |
os.chdir("dir1") |
|
4955.4.10
by Vincent Ladeuil
More simplification. |
972 |
self.assertLogRevnos(['dir2', 'file5'], ['5', '3']) |
5691.1.2
by Jelmer Vernooij
Add tests for ghosts in mainline during log. |
973 |
|
974 |
||
975 |
class MainlineGhostTests(TestLogWithLogCatcher): |
|
976 |
||
977 |
def setUp(self): |
|
978 |
super(MainlineGhostTests, self).setUp() |
|
979 |
tree = self.make_branch_and_tree('') |
|
980 |
tree.set_parent_ids(["spooky"], allow_leftmost_as_ghost=True) |
|
981 |
tree.add('') |
|
982 |
tree.commit('msg1', rev_id='rev1') |
|
983 |
tree.commit('msg2', rev_id='rev2') |
|
984 |
||
985 |
def test_log_range(self): |
|
986 |
self.assertLogRevnos(["-r1..2"], ["2", "1"]) |
|
987 |
||
988 |
def test_log_norange(self): |
|
989 |
self.assertLogRevnos([], ["2", "1"]) |
|
990 |
||
991 |
def test_log_range_open_begin(self): |
|
6050.1.2
by Martin
Make tests raising KnownFailure use the knownFailure method instead |
992 |
self.knownFailure("log with ghosts fails. bug #726466") |
5691.1.2
by Jelmer Vernooij
Add tests for ghosts in mainline during log. |
993 |
(stdout, stderr) = self.run_bzr(['log', '-r..2'], retcode=3) |
994 |
self.assertEqual(["2", "1"], |
|
995 |
[r.revno for r in self.get_captured_revisions()]) |
|
996 |
self.assertEquals("bzr: ERROR: Further revision history missing.", stderr) |
|
997 |
||
998 |
def test_log_range_open_end(self): |
|
999 |
self.assertLogRevnos(["-r1.."], ["2", "1"]) |
|
5935.2.1
by Jacek Sieka
Change the meaning of the log -m option to match and make it match message, committer, authors and bugs. --match-message and friends can be used to make more specific matches. |
1000 |
|
1001 |
class TestLogMatch(TestLogWithLogCatcher): |
|
1002 |
def prepare_tree(self): |
|
1003 |
tree = self.make_branch_and_tree('') |
|
1004 |
self.build_tree( |
|
1005 |
['/hello.txt', '/goodbye.txt']) |
|
1006 |
tree.add('hello.txt') |
|
1007 |
tree.commit(message='message1', committer='committer1', authors=['author1']) |
|
1008 |
tree.add('goodbye.txt') |
|
1009 |
tree.commit(message='message2', committer='committer2', authors=['author2']) |
|
1010 |
||
1011 |
def test_message(self): |
|
1012 |
self.prepare_tree() |
|
1013 |
self.assertLogRevnos(["-m", "message1"], ["1"]) |
|
1014 |
self.assertLogRevnos(["-m", "message2"], ["2"]) |
|
1015 |
self.assertLogRevnos(["-m", "message"], ["2", "1"]) |
|
1016 |
self.assertLogRevnos(["-m", "message1", "-m", "message2"], ["2", "1"]) |
|
1017 |
self.assertLogRevnos(["--match-message", "message1"], ["1"]) |
|
1018 |
self.assertLogRevnos(["--match-message", "message2"], ["2"]) |
|
1019 |
self.assertLogRevnos(["--match-message", "message"], ["2", "1"]) |
|
1020 |
self.assertLogRevnos(["--match-message", "message1", |
|
1021 |
"--match-message", "message2"], ["2", "1"]) |
|
1022 |
self.assertLogRevnos(["--message", "message1"], ["1"]) |
|
1023 |
self.assertLogRevnos(["--message", "message2"], ["2"]) |
|
1024 |
self.assertLogRevnos(["--message", "message"], ["2", "1"]) |
|
1025 |
self.assertLogRevnos(["--match-message", "message1", |
|
1026 |
"--message", "message2"], ["2", "1"]) |
|
1027 |
self.assertLogRevnos(["--message", "message1", |
|
1028 |
"--match-message", "message2"], ["2", "1"]) |
|
1029 |
||
1030 |
def test_committer(self): |
|
1031 |
self.prepare_tree() |
|
1032 |
self.assertLogRevnos(["-m", "committer1"], ["1"]) |
|
1033 |
self.assertLogRevnos(["-m", "committer2"], ["2"]) |
|
1034 |
self.assertLogRevnos(["-m", "committer"], ["2", "1"]) |
|
1035 |
self.assertLogRevnos(["-m", "committer1", "-m", "committer2"], |
|
1036 |
["2", "1"]) |
|
1037 |
self.assertLogRevnos(["--match-committer", "committer1"], ["1"]) |
|
1038 |
self.assertLogRevnos(["--match-committer", "committer2"], ["2"]) |
|
1039 |
self.assertLogRevnos(["--match-committer", "committer"], ["2", "1"]) |
|
1040 |
self.assertLogRevnos(["--match-committer", "committer1", |
|
1041 |
"--match-committer", "committer2"], ["2", "1"]) |
|
1042 |
||
1043 |
def test_author(self): |
|
1044 |
self.prepare_tree() |
|
1045 |
self.assertLogRevnos(["-m", "author1"], ["1"]) |
|
1046 |
self.assertLogRevnos(["-m", "author2"], ["2"]) |
|
1047 |
self.assertLogRevnos(["-m", "author"], ["2", "1"]) |
|
1048 |
self.assertLogRevnos(["-m", "author1", "-m", "author2"], |
|
1049 |
["2", "1"]) |
|
1050 |
self.assertLogRevnos(["--match-author", "author1"], ["1"]) |
|
1051 |
self.assertLogRevnos(["--match-author", "author2"], ["2"]) |
|
1052 |
self.assertLogRevnos(["--match-author", "author"], ["2", "1"]) |
|
1053 |
self.assertLogRevnos(["--match-author", "author1", |
|
1054 |
"--match-author", "author2"], ["2", "1"]) |