bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
4183.6.2
by Martin Pool
Add better message and test for 251352 |
1 |
# Copyright (C) 2005, 2006, 2007, 2009 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 |
|
|
4325.4.3
by Vincent Ladeuil
More cleanups. |
20 |
import os |
21 |
import re |
|
|
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 ( |
24 |
osutils, |
|
25 |
tests, |
|
|
2978.6.1
by Kent Gibson
Use normalize_log to more accurately test blackbox log output. |
26 |
)
|
|
3144.7.9
by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors |
27 |
from bzrlib.tests import test_log |
28 |
||
29 |
||
|
4325.4.3
by Vincent Ladeuil
More cleanups. |
30 |
class TestLog(tests.TestCaseWithTransport): |
|
1540.2.6
by Robey Pointer
make 'log' and 'status' treat '-r N..' as implicitly '-r N..-1' |
31 |
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
32 |
def setUp(self): |
33 |
super(TestLog, self).setUp() |
|
34 |
self.timezone = 0 # UTC |
|
|
4325.4.6
by Vincent Ladeuil
Fixed as per John's and Markus reviews. |
35 |
self.timestamp = 1132617600 # Mon 2005-11-22 00:00:00 +0000 |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
36 |
|
37 |
def make_minimal_branch(self, path='.', format=None): |
|
38 |
tree = self.make_branch_and_tree(path, format=format) |
|
39 |
self.build_tree([path + '/hello.txt']) |
|
40 |
tree.add('hello.txt') |
|
41 |
tree.commit(message='message1') |
|
42 |
return tree |
|
43 |
||
44 |
def make_linear_branch(self, path='.', format=None): |
|
|
2809.1.2
by Daniel Watkins
Removed unnecessary check as per abentley's on-list comments. |
45 |
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. |
46 |
self.build_tree( |
47 |
[path + '/hello.txt', path + '/goodbye.txt', path + '/meep.txt']) |
|
48 |
tree.add('hello.txt') |
|
49 |
tree.commit(message='message1') |
|
50 |
tree.add('goodbye.txt') |
|
51 |
tree.commit(message='message2') |
|
52 |
tree.add('meep.txt') |
|
53 |
tree.commit(message='message3') |
|
54 |
return tree |
|
|
1553.4.2
by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure |
55 |
|
|
4369.2.1
by Marius Kruger
add some leftover log tests |
56 |
def make_merged_branch(self, path='.', format=None): |
|
4369.2.2
by Marius Kruger
use make_linear_branch in make_merged_branch |
57 |
tree = self.make_linear_branch(path, format) |
58 |
tree2 = tree.bzrdir.sprout('tree2', |
|
59 |
revision_id=tree.branch.get_rev_id(1)).open_workingtree() |
|
|
4369.2.1
by Marius Kruger
add some leftover log tests |
60 |
tree2.commit(message='tree2 message2') |
61 |
tree2.commit(message='tree2 message3') |
|
62 |
tree.merge_from_branch(tree2.branch) |
|
63 |
tree.commit(message='merge') |
|
64 |
return tree |
|
65 |
||
66 |
def assertRevnos(self, log, must_have=(), must_not_have=()): |
|
67 |
"""Check if revnos are in or not in the log output""" |
|
68 |
for revno in must_have: |
|
69 |
self.assertTrue(('revno: %s\n' % revno) in log, |
|
70 |
'Does not contain expected revno %s' % revno) |
|
71 |
for revno in must_not_have: |
|
72 |
self.assertFalse(('revno: %s\n' % revno) in log, |
|
73 |
'Contains unexpected revno %s' % revno) |
|
74 |
||
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
75 |
def commit_options(self): |
76 |
"""Use some mostly fixed values for commits to simplify tests. |
|
77 |
||
78 |
Tests can use this function to get some commit attributes. The time
|
|
79 |
stamp is incremented at each commit.
|
|
80 |
"""
|
|
81 |
self.timestamp += 1 # 1 second between each commit |
|
82 |
return dict(committer='Lorem Ipsum <joe@foo.com>', |
|
83 |
timezone=self.timezone, |
|
84 |
timestamp=self.timestamp, |
|
85 |
)
|
|
86 |
||
87 |
def check_log(self, expected, args, working_dir='level0'): |
|
88 |
out, err = self.run_bzr(['log', '--timezone', 'utc'] + args, |
|
89 |
working_dir=working_dir) |
|
90 |
self.assertEqual('', err) |
|
91 |
self.assertEqualDiff(expected, test_log.normalize_log(out)) |
|
92 |
||
93 |
||
94 |
class TestLogRevSpecs(TestLog): |
|
95 |
||
|
1553.4.2
by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure |
96 |
def test_log_null_end_revspec(self): |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
97 |
self.make_linear_branch() |
98 |
log = self.run_bzr(['log'])[0] |
|
99 |
self.assertTrue('revno: 1\n' in log) |
|
100 |
self.assertTrue('revno: 2\n' in log) |
|
101 |
self.assertTrue('revno: 3\n' in log) |
|
102 |
self.assertTrue('message:\n message1\n' in log) |
|
103 |
self.assertTrue('message:\n message2\n' in log) |
|
104 |
self.assertTrue('message:\n message3\n' in log) |
|
|
1553.4.2
by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure |
105 |
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
106 |
full_log = self.run_bzr(['log'])[0] |
|
2530.3.1
by Martin Pool
Cleanup old variations on run_bzr in the test suite |
107 |
log = self.run_bzr("log -r 1..")[0] |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
108 |
self.assertEqualDiff(log, full_log) |
|
1553.4.2
by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure |
109 |
|
110 |
def test_log_null_begin_revspec(self): |
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
111 |
self.make_linear_branch() |
112 |
full_log = self.run_bzr(['log'])[0] |
|
|
2530.3.1
by Martin Pool
Cleanup old variations on run_bzr in the test suite |
113 |
log = self.run_bzr("log -r ..3")[0] |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
114 |
self.assertEqualDiff(full_log, log) |
|
1553.4.2
by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure |
115 |
|
116 |
def test_log_null_both_revspecs(self): |
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
117 |
self.make_linear_branch() |
118 |
full_log = self.run_bzr(['log'])[0] |
|
|
2530.3.1
by Martin Pool
Cleanup old variations on run_bzr in the test suite |
119 |
log = self.run_bzr("log -r ..")[0] |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
120 |
self.assertEqualDiff(full_log, log) |
|
1553.4.2
by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure |
121 |
|
|
2978.4.1
by Kent Gibson
Logging revision 0 returns error. |
122 |
def test_log_zero_revspec(self): |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
123 |
self.make_minimal_branch() |
|
4325.4.6
by Vincent Ladeuil
Fixed as per John's and Markus reviews. |
124 |
self.run_bzr_error(['bzr: ERROR: Logging revision 0 is invalid.'], |
|
2978.4.1
by Kent Gibson
Logging revision 0 returns error. |
125 |
['log', '-r0']) |
126 |
||
127 |
def test_log_zero_begin_revspec(self): |
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
128 |
self.make_linear_branch() |
|
4325.4.6
by Vincent Ladeuil
Fixed as per John's and Markus reviews. |
129 |
self.run_bzr_error(['bzr: ERROR: Logging revision 0 is invalid.'], |
|
2978.4.1
by Kent Gibson
Logging revision 0 returns error. |
130 |
['log', '-r0..2']) |
131 |
||
132 |
def test_log_zero_end_revspec(self): |
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
133 |
self.make_linear_branch() |
|
4325.4.6
by Vincent Ladeuil
Fixed as per John's and Markus reviews. |
134 |
self.run_bzr_error(['bzr: ERROR: Logging revision 0 is invalid.'], |
|
2978.4.1
by Kent Gibson
Logging revision 0 returns error. |
135 |
['log', '-r-2..0']) |
136 |
||
|
1553.4.2
by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure |
137 |
def test_log_negative_begin_revspec_full_log(self): |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
138 |
self.make_linear_branch() |
139 |
full_log = self.run_bzr(['log'])[0] |
|
|
2530.3.1
by Martin Pool
Cleanup old variations on run_bzr in the test suite |
140 |
log = self.run_bzr("log -r -3..")[0] |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
141 |
self.assertEqualDiff(full_log, log) |
|
1553.4.2
by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure |
142 |
|
143 |
def test_log_negative_both_revspec_full_log(self): |
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
144 |
self.make_linear_branch() |
145 |
full_log = self.run_bzr(['log'])[0] |
|
|
2530.3.1
by Martin Pool
Cleanup old variations on run_bzr in the test suite |
146 |
log = self.run_bzr("log -r -3..-1")[0] |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
147 |
self.assertEqualDiff(full_log, log) |
|
1553.4.2
by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure |
148 |
|
149 |
def test_log_negative_both_revspec_partial(self): |
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
150 |
self.make_linear_branch() |
|
2530.3.1
by Martin Pool
Cleanup old variations on run_bzr in the test suite |
151 |
log = self.run_bzr("log -r -3..-2")[0] |
|
1553.4.2
by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure |
152 |
self.assertTrue('revno: 1\n' in log) |
153 |
self.assertTrue('revno: 2\n' in log) |
|
154 |
self.assertTrue('revno: 3\n' not in log) |
|
155 |
||
156 |
def test_log_negative_begin_revspec(self): |
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
157 |
self.make_linear_branch() |
|
2530.3.1
by Martin Pool
Cleanup old variations on run_bzr in the test suite |
158 |
log = self.run_bzr("log -r -2..")[0] |
|
1553.4.2
by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure |
159 |
self.assertTrue('revno: 1\n' not in log) |
160 |
self.assertTrue('revno: 2\n' in log) |
|
161 |
self.assertTrue('revno: 3\n' in log) |
|
162 |
||
|
2978.4.1
by Kent Gibson
Logging revision 0 returns error. |
163 |
def test_log_positive_revspecs(self): |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
164 |
self.make_linear_branch() |
165 |
full_log = self.run_bzr(['log'])[0] |
|
|
2530.3.1
by Martin Pool
Cleanup old variations on run_bzr in the test suite |
166 |
log = self.run_bzr("log -r 1..3")[0] |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
167 |
self.assertEqualDiff(full_log, log) |
|
1624.1.3
by Robert Collins
Convert log to use the new tsort.merge_sort routine. |
168 |
|
|
4369.2.1
by Marius Kruger
add some leftover log tests |
169 |
def test_log_dotted_revspecs(self): |
170 |
self.make_merged_branch() |
|
171 |
log = self.run_bzr("log -n0 -r 1..1.1.1")[0] |
|
172 |
self.assertRevnos(log, (1, '1.1.1'), (2, 3, '1.1.2', 4)) |
|
173 |
||
|
2466.12.1
by Kent Gibson
Fix ``bzr log -r`` to support selecting merge revisions. |
174 |
def test_log_reversed_revspecs(self): |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
175 |
self.make_linear_branch() |
|
2466.12.1
by Kent Gibson
Fix ``bzr log -r`` to support selecting merge revisions. |
176 |
self.run_bzr_error(('bzr: ERROR: Start revision must be older than ' |
177 |
'the end revision.\n',), |
|
|
2581.1.6
by Martin Pool
fix up more run_bzr callers |
178 |
['log', '-r3..1']) |
|
2466.12.1
by Kent Gibson
Fix ``bzr log -r`` to support selecting merge revisions. |
179 |
|
|
4369.2.1
by Marius Kruger
add some leftover log tests |
180 |
def test_log_reversed_dotted_revspecs(self): |
181 |
self.make_merged_branch() |
|
182 |
self.run_bzr_error(('bzr: ERROR: Start revision not found in ' |
|
183 |
'left-hand history of end revision.\n',), |
|
184 |
"log -r 1.1.1..1") |
|
185 |
||
|
1907.4.2
by Matthieu Moy
Make log work nicely with revno:N:path too. |
186 |
def test_log_revno_n_path(self): |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
187 |
self.make_linear_branch('branch1') |
188 |
self.make_linear_branch('branch2') |
|
189 |
# Swapped revisions
|
|
190 |
self.run_bzr("log -r revno:2:branch1..revno:3:branch2", retcode=3)[0] |
|
191 |
# Correct order
|
|
|
2530.3.1
by Martin Pool
Cleanup old variations on run_bzr in the test suite |
192 |
log = self.run_bzr("log -r revno:1:branch2..revno:3:branch2")[0] |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
193 |
full_log = self.run_bzr(['log'], working_dir='branch2')[0] |
194 |
self.assertEqualDiff(full_log, log) |
|
|
2530.3.1
by Martin Pool
Cleanup old variations on run_bzr in the test suite |
195 |
log = self.run_bzr("log -r revno:1:branch2")[0] |
|
1907.4.2
by Matthieu Moy
Make log work nicely with revno:N:path too. |
196 |
self.assertTrue('revno: 1\n' in log) |
197 |
self.assertTrue('revno: 2\n' not in log) |
|
198 |
self.assertTrue('branch nick: branch2\n' in log) |
|
199 |
self.assertTrue('branch nick: branch1\n' not in log) |
|
|
3734.1.1
by Vincent Ladeuil
Fix bug #248427 by adding a --change option to log. |
200 |
|
|
3878.3.3
by Marius Kruger
Add tests for log -r with non-exising revno's |
201 |
def test_log_nonexistent_revno(self): |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
202 |
self.make_minimal_branch() |
|
4325.4.6
by Vincent Ladeuil
Fixed as per John's and Markus reviews. |
203 |
(out, err) = self.run_bzr_error( |
204 |
["bzr: ERROR: Requested revision: '1234' " |
|
205 |
"does not exist in branch:"], |
|
206 |
['log', '-r1234']) |
|
|
3878.3.3
by Marius Kruger
Add tests for log -r with non-exising revno's |
207 |
|
208 |
def test_log_nonexistent_dotted_revno(self): |
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
209 |
self.make_minimal_branch() |
|
4325.4.6
by Vincent Ladeuil
Fixed as per John's and Markus reviews. |
210 |
(out, err) = self.run_bzr_error( |
211 |
["bzr: ERROR: Requested revision: '123.123' " |
|
212 |
"does not exist in branch:"], |
|
213 |
['log', '-r123.123']) |
|
|
3878.3.3
by Marius Kruger
Add tests for log -r with non-exising revno's |
214 |
|
|
3734.1.1
by Vincent Ladeuil
Fix bug #248427 by adding a --change option to log. |
215 |
def test_log_change_revno(self): |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
216 |
self.make_linear_branch() |
|
3734.1.1
by Vincent Ladeuil
Fix bug #248427 by adding a --change option to log. |
217 |
expected_log = self.run_bzr("log -r 1")[0] |
218 |
log = self.run_bzr("log -c 1")[0] |
|
219 |
self.assertEqualDiff(expected_log, log) |
|
220 |
||
|
3878.3.2
by Marius Kruger
Add tests for log -c with non-exising revno's |
221 |
def test_log_change_nonexistent_revno(self): |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
222 |
self.make_minimal_branch() |
|
4325.4.6
by Vincent Ladeuil
Fixed as per John's and Markus reviews. |
223 |
(out, err) = self.run_bzr_error( |
224 |
["bzr: ERROR: Requested revision: '1234' " |
|
225 |
"does not exist in branch:"], |
|
226 |
['log', '-c1234']) |
|
|
3878.3.2
by Marius Kruger
Add tests for log -c with non-exising revno's |
227 |
|
228 |
def test_log_change_nonexistent_dotted_revno(self): |
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
229 |
self.make_minimal_branch() |
|
4325.4.6
by Vincent Ladeuil
Fixed as per John's and Markus reviews. |
230 |
(out, err) = self.run_bzr_error( |
231 |
["bzr: ERROR: Requested revision: '123.123' " |
|
232 |
"does not exist in branch:"], |
|
233 |
['log', '-c123.123']) |
|
|
3878.3.2
by Marius Kruger
Add tests for log -c with non-exising revno's |
234 |
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
235 |
def test_log_change_single_revno_only(self): |
236 |
self.make_minimal_branch() |
|
|
4325.4.6
by Vincent Ladeuil
Fixed as per John's and Markus reviews. |
237 |
self.run_bzr_error(['bzr: ERROR: Option --change does not' |
238 |
' accept revision ranges'], |
|
|
3734.1.1
by Vincent Ladeuil
Fix bug #248427 by adding a --change option to log. |
239 |
['log', '--change', '2..3']) |
240 |
||
241 |
def test_log_change_incompatible_with_revision(self): |
|
|
4325.4.6
by Vincent Ladeuil
Fixed as per John's and Markus reviews. |
242 |
self.run_bzr_error(['bzr: ERROR: --revision and --change' |
243 |
' are mutually exclusive'], |
|
|
3734.1.1
by Vincent Ladeuil
Fix bug #248427 by adding a --change option to log. |
244 |
['log', '--change', '2', '--revision', '3']) |
245 |
||
|
2100.1.1
by wang
Running ``bzr log`` on nonexistent file gives an error instead of the |
246 |
def test_log_nonexistent_file(self): |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
247 |
self.make_minimal_branch() |
|
2100.1.1
by wang
Running ``bzr log`` on nonexistent file gives an error instead of the |
248 |
# files that don't exist in either the basis tree or working tree
|
249 |
# should give an error
|
|
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
250 |
out, err = self.run_bzr('log does-not-exist', retcode=3) |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
251 |
self.assertContainsRe(err, |
252 |
'Path unknown at end or start of revision range: '
|
|
253 |
'does-not-exist') |
|
|
2388.1.11
by Alexander Belchenko
changes after John's review |
254 |
|
|
2388.1.3
by Erik Bagfors
tests for tags in log output |
255 |
def test_log_with_tags(self): |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
256 |
tree = self.make_linear_branch(format='dirstate-tags') |
|
2664.14.1
by Daniel Watkins
Fixed tests.blackbox.test_log to use internals where appropriate. |
257 |
branch = tree.branch |
258 |
branch.tags.set_tag('tag1', branch.get_rev_id(1)) |
|
259 |
branch.tags.set_tag('tag1.1', branch.get_rev_id(1)) |
|
|
3842.2.5
by Vincent Ladeuil
Better fix for bug #300055. |
260 |
branch.tags.set_tag('tag3', branch.last_revision()) |
261 |
||
|
2530.3.1
by Martin Pool
Cleanup old variations on run_bzr in the test suite |
262 |
log = self.run_bzr("log -r-1")[0] |
|
2388.1.3
by Erik Bagfors
tests for tags in log output |
263 |
self.assertTrue('tags: tag3' in log) |
264 |
||
|
2530.3.1
by Martin Pool
Cleanup old variations on run_bzr in the test suite |
265 |
log = self.run_bzr("log -r1")[0] |
|
2388.1.3
by Erik Bagfors
tests for tags in log output |
266 |
# I guess that we can't know the order of tags in the output
|
267 |
# since dicts are unordered, need to check both possibilities
|
|
|
2388.1.11
by Alexander Belchenko
changes after John's review |
268 |
self.assertContainsRe(log, r'tags: (tag1, tag1\.1|tag1\.1, tag1)') |
269 |
||
|
2388.1.9
by Erik Bagfors
test for merges with tags in log |
270 |
def test_merged_log_with_tags(self): |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
271 |
branch1_tree = self.make_linear_branch('branch1', |
272 |
format='dirstate-tags') |
|
|
2664.14.1
by Daniel Watkins
Fixed tests.blackbox.test_log to use internals where appropriate. |
273 |
branch1 = branch1_tree.branch |
274 |
branch2_tree = branch1_tree.bzrdir.sprout('branch2').open_workingtree() |
|
275 |
branch1_tree.commit(message='foobar', allow_pointless=True) |
|
276 |
branch1.tags.set_tag('tag1', branch1.last_revision()) |
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
277 |
# tags don't propagate if we don't merge
|
278 |
self.run_bzr('merge ../branch1', working_dir='branch2') |
|
|
2664.14.1
by Daniel Watkins
Fixed tests.blackbox.test_log to use internals where appropriate. |
279 |
branch2_tree.commit(message='merge branch 1') |
|
4511.3.11
by Marius Kruger
* fix tests again |
280 |
log = self.run_bzr("log -n0 -r-1", working_dir='branch2')[0] |
|
2388.1.11
by Alexander Belchenko
changes after John's review |
281 |
self.assertContainsRe(log, r' tags: tag1') |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
282 |
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 |
283 |
self.assertContainsRe(log, r'tags: tag1') |
|
2388.1.3
by Erik Bagfors
tests for tags in log output |
284 |
|
|
2466.9.1
by Kent Gibson
add bzr log --limit |
285 |
def test_log_limit(self): |
|
3660.1.1
by Robert Collins
Fix log --limit (broken by log filtering patch). |
286 |
tree = self.make_branch_and_tree('.') |
287 |
# We want more commits than our batch size starts at
|
|
288 |
for pos in range(10): |
|
289 |
tree.commit("%s" % pos) |
|
|
2530.3.1
by Martin Pool
Cleanup old variations on run_bzr in the test suite |
290 |
log = self.run_bzr("log --limit 2")[0] |
|
3108.1.3
by Matt Nordhoff
Use assertContainsRe/assertNotContainsRe in tests. |
291 |
self.assertNotContainsRe(log, r'revno: 1\n') |
|
3660.1.1
by Robert Collins
Fix log --limit (broken by log filtering patch). |
292 |
self.assertNotContainsRe(log, r'revno: 2\n') |
293 |
self.assertNotContainsRe(log, r'revno: 3\n') |
|
294 |
self.assertNotContainsRe(log, r'revno: 4\n') |
|
295 |
self.assertNotContainsRe(log, r'revno: 5\n') |
|
296 |
self.assertNotContainsRe(log, r'revno: 6\n') |
|
297 |
self.assertNotContainsRe(log, r'revno: 7\n') |
|
298 |
self.assertNotContainsRe(log, r'revno: 8\n') |
|
299 |
self.assertContainsRe(log, r'revno: 9\n') |
|
300 |
self.assertContainsRe(log, r'revno: 10\n') |
|
|
2466.9.1
by Kent Gibson
add bzr log --limit |
301 |
|
|
3108.1.2
by Matt Nordhoff
Simple copied unit test. |
302 |
def test_log_limit_short(self): |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
303 |
self.make_linear_branch() |
|
3108.1.2
by Matt Nordhoff
Simple copied unit test. |
304 |
log = self.run_bzr("log -l 2")[0] |
|
3108.1.3
by Matt Nordhoff
Use assertContainsRe/assertNotContainsRe in tests. |
305 |
self.assertNotContainsRe(log, r'revno: 1\n') |
306 |
self.assertContainsRe(log, r'revno: 2\n') |
|
307 |
self.assertContainsRe(log, r'revno: 3\n') |
|
|
3144.7.9
by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors |
308 |
|
|
4183.6.2
by Martin Pool
Add better message and test for 251352 |
309 |
def test_log_bad_message_re(self): |
310 |
"""Bad --message argument gives a sensible message |
|
311 |
|
|
312 |
See https://bugs.launchpad.net/bzr/+bug/251352
|
|
313 |
"""
|
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
314 |
self.make_minimal_branch() |
|
4183.6.2
by Martin Pool
Add better message and test for 251352 |
315 |
out, err = self.run_bzr(['log', '-m', '*'], retcode=3) |
|
4183.6.4
by Martin Pool
Separate out re_compile_checked |
316 |
self.assertEqual("bzr: ERROR: Invalid regular expression" |
317 |
" in log message filter"
|
|
318 |
": '*'"
|
|
319 |
": nothing to repeat\n", err) |
|
|
4183.6.2
by Martin Pool
Add better message and test for 251352 |
320 |
self.assertEqual('', out) |
|
3874.1.8
by Vincent Ladeuil
Fixed as ber Robert's review. |
321 |
|
|
4202.2.1
by Ian Clatworthy
get directory logging working again |
322 |
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
323 |
class TestLogTimeZone(TestLog): |
324 |
||
325 |
def test_log_unsupported_timezone(self): |
|
326 |
self.make_linear_branch() |
|
|
4325.4.6
by Vincent Ladeuil
Fixed as per John's and Markus reviews. |
327 |
self.run_bzr_error(['bzr: ERROR: Unsupported timezone format "foo", ' |
328 |
'options are "utc", "original", "local".'], |
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
329 |
['log', '--timezone', 'foo']) |
330 |
||
331 |
||
332 |
class TestLogVerbose(TestLog): |
|
|
3874.1.8
by Vincent Ladeuil
Fixed as ber Robert's review. |
333 |
|
334 |
def setUp(self): |
|
335 |
super(TestLogVerbose, self).setUp() |
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
336 |
self.make_minimal_branch() |
|
3874.1.8
by Vincent Ladeuil
Fixed as ber Robert's review. |
337 |
|
338 |
def assertUseShortDeltaFormat(self, cmd): |
|
339 |
log = self.run_bzr(cmd)[0] |
|
340 |
# Check that we use the short status format
|
|
|
3947.1.7
by Ian Clatworthy
tweak indenting/offsetting for --short given dotted revno lengths |
341 |
self.assertContainsRe(log, '(?m)^\s*A hello.txt$') |
342 |
self.assertNotContainsRe(log, '(?m)^\s*added:$') |
|
|
3874.1.4
by Vincent Ladeuil
Fixed as per Aarons' comment. |
343 |
|
|
3874.1.8
by Vincent Ladeuil
Fixed as ber Robert's review. |
344 |
def assertUseLongDeltaFormat(self, cmd): |
345 |
log = self.run_bzr(cmd)[0] |
|
346 |
# Check that we use the long status format
|
|
|
3947.1.7
by Ian Clatworthy
tweak indenting/offsetting for --short given dotted revno lengths |
347 |
self.assertNotContainsRe(log, '(?m)^\s*A hello.txt$') |
348 |
self.assertContainsRe(log, '(?m)^\s*added:$') |
|
|
3874.1.8
by Vincent Ladeuil
Fixed as ber Robert's review. |
349 |
|
350 |
def test_log_short_verbose(self): |
|
351 |
self.assertUseShortDeltaFormat(['log', '--short', '-v']) |
|
352 |
||
|
3874.1.4
by Vincent Ladeuil
Fixed as per Aarons' comment. |
353 |
def test_log_short_verbose_verbose(self): |
|
3874.1.8
by Vincent Ladeuil
Fixed as ber Robert's review. |
354 |
self.assertUseLongDeltaFormat(['log', '--short', '-vv']) |
|
3874.1.4
by Vincent Ladeuil
Fixed as per Aarons' comment. |
355 |
|
356 |
def test_log_long_verbose(self): |
|
|
3874.1.7
by Vincent Ladeuil
Restrict '-v' change to log --short only. |
357 |
# Check that we use the long status format, ignoring the verbosity
|
358 |
# level
|
|
|
3874.1.8
by Vincent Ladeuil
Fixed as ber Robert's review. |
359 |
self.assertUseLongDeltaFormat(['log', '--long', '-v']) |
|
3874.1.4
by Vincent Ladeuil
Fixed as per Aarons' comment. |
360 |
|
361 |
def test_log_long_verbose_verbose(self): |
|
|
3874.1.7
by Vincent Ladeuil
Restrict '-v' change to log --short only. |
362 |
# Check that we use the long status format, ignoring the verbosity
|
363 |
# level
|
|
|
3874.1.8
by Vincent Ladeuil
Fixed as ber Robert's review. |
364 |
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. |
365 |
|
|
3144.7.9
by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors |
366 |
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
367 |
class TestLogMerges(TestLog): |
368 |
||
369 |
def setUp(self): |
|
370 |
super(TestLogMerges, self).setUp() |
|
371 |
self.make_branches_with_merges() |
|
372 |
||
373 |
def make_branches_with_merges(self): |
|
374 |
level0 = self.make_branch_and_tree('level0') |
|
375 |
level0.commit(message='in branch level0', **self.commit_options()) |
|
376 |
||
377 |
level1 = level0.bzrdir.sprout('level1').open_workingtree() |
|
378 |
level1.commit(message='in branch level1', **self.commit_options()) |
|
379 |
||
380 |
level2 = level1.bzrdir.sprout('level2').open_workingtree() |
|
381 |
level2.commit(message='in branch level2', **self.commit_options()) |
|
382 |
||
383 |
level1.merge_from_branch(level2.branch) |
|
384 |
level1.commit(message='merge branch level2', **self.commit_options()) |
|
385 |
||
386 |
level0.merge_from_branch(level1.branch) |
|
387 |
level0.commit(message='merge branch level1', **self.commit_options()) |
|
|
3947.1.3
by Ian Clatworthy
blackbox tests |
388 |
|
|
2466.12.1
by Kent Gibson
Fix ``bzr log -r`` to support selecting merge revisions. |
389 |
def test_merges_are_indented_by_level(self): |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
390 |
expected = """\ |
|
2978.6.1
by Kent Gibson
Use normalize_log to more accurately test blackbox log output. |
391 |
------------------------------------------------------------
|
|
4208.2.1
by Ian Clatworthy
merge indicators in log --long |
392 |
revno: 2 [merge]
|
|
2978.6.1
by Kent Gibson
Use normalize_log to more accurately test blackbox log output. |
393 |
committer: Lorem Ipsum <test@example.com>
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
394 |
branch nick: level0
|
|
2978.6.1
by Kent Gibson
Use normalize_log to more accurately test blackbox log output. |
395 |
timestamp: Just now
|
396 |
message:
|
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
397 |
merge branch level1
|
|
2978.6.1
by Kent Gibson
Use normalize_log to more accurately test blackbox log output. |
398 |
------------------------------------------------------------
|
|
4208.2.1
by Ian Clatworthy
merge indicators in log --long |
399 |
revno: 1.1.2 [merge]
|
|
2978.6.1
by Kent Gibson
Use normalize_log to more accurately test blackbox log output. |
400 |
committer: Lorem Ipsum <test@example.com>
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
401 |
branch nick: level1
|
|
2978.6.1
by Kent Gibson
Use normalize_log to more accurately test blackbox log output. |
402 |
timestamp: Just now
|
403 |
message:
|
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
404 |
merge branch level2
|
|
2978.6.1
by Kent Gibson
Use normalize_log to more accurately test blackbox log output. |
405 |
------------------------------------------------------------
|
|
3170.3.4
by John Arbash Meinel
Update the tests for the new revision numbering. |
406 |
revno: 1.2.1
|
|
2978.6.1
by Kent Gibson
Use normalize_log to more accurately test blackbox log output. |
407 |
committer: Lorem Ipsum <test@example.com>
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
408 |
branch nick: level2
|
|
2978.6.1
by Kent Gibson
Use normalize_log to more accurately test blackbox log output. |
409 |
timestamp: Just now
|
410 |
message:
|
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
411 |
in branch level2
|
|
2978.6.1
by Kent Gibson
Use normalize_log to more accurately test blackbox log output. |
412 |
------------------------------------------------------------
|
413 |
revno: 1.1.1
|
|
414 |
committer: Lorem Ipsum <test@example.com>
|
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
415 |
branch nick: level1
|
|
2978.6.1
by Kent Gibson
Use normalize_log to more accurately test blackbox log output. |
416 |
timestamp: Just now
|
417 |
message:
|
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
418 |
in branch level1
|
|
2978.6.1
by Kent Gibson
Use normalize_log to more accurately test blackbox log output. |
419 |
------------------------------------------------------------
|
420 |
revno: 1
|
|
421 |
committer: Lorem Ipsum <test@example.com>
|
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
422 |
branch nick: level0
|
|
2978.6.1
by Kent Gibson
Use normalize_log to more accurately test blackbox log output. |
423 |
timestamp: Just now
|
424 |
message:
|
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
425 |
in branch level0
|
426 |
"""
|
|
427 |
self.check_log(expected, ['-n0']) |
|
|
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
428 |
|
|
3947.1.3
by Ian Clatworthy
blackbox tests |
429 |
def test_force_merge_revisions_off(self): |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
430 |
expected = """\ |
|
3947.1.3
by Ian Clatworthy
blackbox tests |
431 |
------------------------------------------------------------
|
|
4208.2.1
by Ian Clatworthy
merge indicators in log --long |
432 |
revno: 2 [merge]
|
|
3947.1.3
by Ian Clatworthy
blackbox tests |
433 |
committer: Lorem Ipsum <test@example.com>
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
434 |
branch nick: level0
|
|
3947.1.3
by Ian Clatworthy
blackbox tests |
435 |
timestamp: Just now
|
436 |
message:
|
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
437 |
merge branch level1
|
|
3947.1.3
by Ian Clatworthy
blackbox tests |
438 |
------------------------------------------------------------
|
439 |
revno: 1
|
|
440 |
committer: Lorem Ipsum <test@example.com>
|
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
441 |
branch nick: level0
|
|
3947.1.3
by Ian Clatworthy
blackbox tests |
442 |
timestamp: Just now
|
443 |
message:
|
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
444 |
in branch level0
|
445 |
"""
|
|
446 |
self.check_log(expected, ['--long', '-n1']) |
|
|
3947.1.3
by Ian Clatworthy
blackbox tests |
447 |
|
448 |
def test_force_merge_revisions_on(self): |
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
449 |
expected = """\ |
450 |
2 Lorem Ipsum\t2005-11-22 [merge] |
|
451 |
merge branch level1
|
|
452 |
||
453 |
1.1.2 Lorem Ipsum\t2005-11-22 [merge] |
|
454 |
merge branch level2
|
|
455 |
||
456 |
1.2.1 Lorem Ipsum\t2005-11-22 |
|
457 |
in branch level2
|
|
458 |
||
459 |
1.1.1 Lorem Ipsum\t2005-11-22 |
|
460 |
in branch level1
|
|
461 |
||
462 |
1 Lorem Ipsum\t2005-11-22 |
|
463 |
in branch level0
|
|
464 |
||
465 |
"""
|
|
466 |
self.check_log(expected, ['--short', '-n0']) |
|
|
3947.1.7
by Ian Clatworthy
tweak indenting/offsetting for --short given dotted revno lengths |
467 |
|
|
4221.2.1
by Ian Clatworthy
--include-merges as an alias for --levels 0 in log |
468 |
def test_include_merges(self): |
469 |
# Confirm --include-merges gives the same output as -n0
|
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
470 |
out_im, err_im = self.run_bzr('log --include-merges', |
471 |
working_dir='level0') |
|
472 |
out_n0, err_n0 = self.run_bzr('log -n0', working_dir='level0') |
|
473 |
self.assertEqual('', err_im) |
|
474 |
self.assertEqual('', err_n0) |
|
|
4221.2.1
by Ian Clatworthy
--include-merges as an alias for --levels 0 in log |
475 |
self.assertEqual(out_im, out_n0) |
476 |
||
|
3947.1.7
by Ian Clatworthy
tweak indenting/offsetting for --short given dotted revno lengths |
477 |
def test_force_merge_revisions_N(self): |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
478 |
expected = """\ |
479 |
2 Lorem Ipsum\t2005-11-22 [merge] |
|
480 |
merge branch level1
|
|
481 |
||
482 |
1.1.2 Lorem Ipsum\t2005-11-22 [merge] |
|
483 |
merge branch level2
|
|
484 |
||
485 |
1.1.1 Lorem Ipsum\t2005-11-22 |
|
486 |
in branch level1
|
|
487 |
||
488 |
1 Lorem Ipsum\t2005-11-22 |
|
489 |
in branch level0
|
|
490 |
||
491 |
"""
|
|
492 |
self.check_log(expected, ['--short', '-n2']) |
|
|
3947.1.3
by Ian Clatworthy
blackbox tests |
493 |
|
|
2466.12.1
by Kent Gibson
Fix ``bzr log -r`` to support selecting merge revisions. |
494 |
def test_merges_single_merge_rev(self): |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
495 |
expected = """\ |
|
2978.6.1
by Kent Gibson
Use normalize_log to more accurately test blackbox log output. |
496 |
------------------------------------------------------------
|
|
4208.2.1
by Ian Clatworthy
merge indicators in log --long |
497 |
revno: 1.1.2 [merge]
|
|
2978.6.1
by Kent Gibson
Use normalize_log to more accurately test blackbox log output. |
498 |
committer: Lorem Ipsum <test@example.com>
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
499 |
branch nick: level1
|
|
2978.6.1
by Kent Gibson
Use normalize_log to more accurately test blackbox log output. |
500 |
timestamp: Just now
|
501 |
message:
|
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
502 |
merge branch level2
|
|
4511.3.11
by Marius Kruger
* fix tests again |
503 |
------------------------------------------------------------
|
504 |
revno: 1.2.1
|
|
505 |
committer: Lorem Ipsum <test@example.com>
|
|
506 |
branch nick: level2
|
|
507 |
timestamp: Just now
|
|
508 |
message:
|
|
509 |
in branch level2
|
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
510 |
"""
|
511 |
self.check_log(expected, ['-n0', '-r1.1.2']) |
|
|
2466.12.1
by Kent Gibson
Fix ``bzr log -r`` to support selecting merge revisions. |
512 |
|
513 |
def test_merges_partial_range(self): |
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
514 |
expected = """\ |
|
2978.6.1
by Kent Gibson
Use normalize_log to more accurately test blackbox log output. |
515 |
------------------------------------------------------------
|
|
4208.2.1
by Ian Clatworthy
merge indicators in log --long |
516 |
revno: 1.1.2 [merge]
|
|
2978.6.1
by Kent Gibson
Use normalize_log to more accurately test blackbox log output. |
517 |
committer: Lorem Ipsum <test@example.com>
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
518 |
branch nick: level1
|
|
2978.6.1
by Kent Gibson
Use normalize_log to more accurately test blackbox log output. |
519 |
timestamp: Just now
|
520 |
message:
|
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
521 |
merge branch level2
|
|
2978.6.1
by Kent Gibson
Use normalize_log to more accurately test blackbox log output. |
522 |
------------------------------------------------------------
|
|
3170.3.4
by John Arbash Meinel
Update the tests for the new revision numbering. |
523 |
revno: 1.2.1
|
|
2978.6.1
by Kent Gibson
Use normalize_log to more accurately test blackbox log output. |
524 |
committer: Lorem Ipsum <test@example.com>
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
525 |
branch nick: level2
|
|
2978.6.1
by Kent Gibson
Use normalize_log to more accurately test blackbox log output. |
526 |
timestamp: Just now
|
527 |
message:
|
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
528 |
in branch level2
|
|
2978.6.1
by Kent Gibson
Use normalize_log to more accurately test blackbox log output. |
529 |
------------------------------------------------------------
|
530 |
revno: 1.1.1
|
|
531 |
committer: Lorem Ipsum <test@example.com>
|
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
532 |
branch nick: level1
|
|
2978.6.1
by Kent Gibson
Use normalize_log to more accurately test blackbox log output. |
533 |
timestamp: Just now
|
534 |
message:
|
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
535 |
in branch level1
|
536 |
"""
|
|
537 |
self.check_log(expected, ['-n0', '-r1.1.1..1.1.2']) |
|
538 |
||
|
4511.3.1
by Marius Kruger
add test_merges_partial_range_ignore_before_lower_bound |
539 |
def test_merges_partial_range_ignore_before_lower_bound(self): |
|
4511.3.11
by Marius Kruger
* fix tests again |
540 |
"""Dont show revisions before the lower bound's merged revs""" |
|
4511.3.1
by Marius Kruger
add test_merges_partial_range_ignore_before_lower_bound |
541 |
expected = """\ |
542 |
2 Lorem Ipsum\t2005-11-22 [merge] |
|
543 |
merge branch level1
|
|
544 |
||
545 |
1.1.2 Lorem Ipsum\t2005-11-22 [merge] |
|
546 |
merge branch level2
|
|
547 |
||
|
4511.3.11
by Marius Kruger
* fix tests again |
548 |
1.2.1 Lorem Ipsum\t2005-11-22 |
549 |
in branch level2
|
|
550 |
||
|
4511.3.1
by Marius Kruger
add test_merges_partial_range_ignore_before_lower_bound |
551 |
"""
|
552 |
self.check_log(expected, ['--short', '-n0', '-r1.1.2..2']) |
|
553 |
||
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
554 |
|
555 |
class TestLogDiff(TestLog): |
|
556 |
||
557 |
def setUp(self): |
|
558 |
super(TestLogDiff, self).setUp() |
|
559 |
self.make_branch_with_diffs() |
|
560 |
||
561 |
def make_branch_with_diffs(self): |
|
562 |
level0 = self.make_branch_and_tree('level0') |
|
563 |
self.build_tree(['level0/file1', 'level0/file2']) |
|
564 |
level0.add('file1') |
|
565 |
level0.add('file2') |
|
566 |
level0.commit(message='in branch level0', **self.commit_options()) |
|
567 |
||
568 |
level1 = level0.bzrdir.sprout('level1').open_workingtree() |
|
569 |
self.build_tree_contents([('level1/file2', 'hello\n')]) |
|
570 |
level1.commit(message='in branch level1', **self.commit_options()) |
|
571 |
level0.merge_from_branch(level1.branch) |
|
572 |
level0.commit(message='merge branch level1', **self.commit_options()) |
|
|
3943.5.3
by Ian Clatworthy
add tests |
573 |
|
|
4206.1.1
by Ian Clatworthy
log mainline by default |
574 |
def test_log_show_diff_long_with_merges(self): |
575 |
out,err = self.run_bzr('log -p -n0') |
|
|
3943.5.3
by Ian Clatworthy
add tests |
576 |
self.assertEqual('', err) |
|
4325.4.3
by Vincent Ladeuil
More cleanups. |
577 |
log = test_log.normalize_log(out) |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
578 |
expected = """\ |
|
3943.5.3
by Ian Clatworthy
add tests |
579 |
------------------------------------------------------------
|
|
4208.2.1
by Ian Clatworthy
merge indicators in log --long |
580 |
revno: 2 [merge]
|
|
3943.5.3
by Ian Clatworthy
add tests |
581 |
committer: Lorem Ipsum <test@example.com>
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
582 |
branch nick: level0
|
|
3943.5.3
by Ian Clatworthy
add tests |
583 |
timestamp: Just now
|
584 |
message:
|
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
585 |
merge branch level1
|
|
3943.5.3
by Ian Clatworthy
add tests |
586 |
diff:
|
|
3943.5.6
by Ian Clatworthy
feedback from jam's review |
587 |
=== modified file 'file2'
|
|
4325.4.6
by Vincent Ladeuil
Fixed as per John's and Markus reviews. |
588 |
--- file2\t2005-11-22 00:00:01 +0000 |
589 |
+++ file2\t2005-11-22 00:00:02 +0000 |
|
|
3943.5.6
by Ian Clatworthy
feedback from jam's review |
590 |
@@ -1,1 +1,1 @@
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
591 |
-contents of level0/file2
|
|
3943.5.6
by Ian Clatworthy
feedback from jam's review |
592 |
+hello
|
|
3943.5.3
by Ian Clatworthy
add tests |
593 |
------------------------------------------------------------
|
594 |
revno: 1.1.1
|
|
595 |
committer: Lorem Ipsum <test@example.com>
|
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
596 |
branch nick: level1
|
|
3943.5.3
by Ian Clatworthy
add tests |
597 |
timestamp: Just now
|
598 |
message:
|
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
599 |
in branch level1
|
|
3943.5.3
by Ian Clatworthy
add tests |
600 |
diff:
|
|
3943.5.6
by Ian Clatworthy
feedback from jam's review |
601 |
=== modified file 'file2'
|
|
4325.4.6
by Vincent Ladeuil
Fixed as per John's and Markus reviews. |
602 |
--- file2\t2005-11-22 00:00:01 +0000 |
603 |
+++ file2\t2005-11-22 00:00:02 +0000 |
|
|
3943.5.6
by Ian Clatworthy
feedback from jam's review |
604 |
@@ -1,1 +1,1 @@
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
605 |
-contents of level0/file2
|
|
3943.5.6
by Ian Clatworthy
feedback from jam's review |
606 |
+hello
|
|
3943.5.3
by Ian Clatworthy
add tests |
607 |
------------------------------------------------------------
|
608 |
revno: 1
|
|
609 |
committer: Lorem Ipsum <test@example.com>
|
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
610 |
branch nick: level0
|
|
3943.5.3
by Ian Clatworthy
add tests |
611 |
timestamp: Just now
|
612 |
message:
|
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
613 |
in branch level0
|
|
3943.5.3
by Ian Clatworthy
add tests |
614 |
diff:
|
|
3943.5.6
by Ian Clatworthy
feedback from jam's review |
615 |
=== added file 'file1'
|
|
4325.4.6
by Vincent Ladeuil
Fixed as per John's and Markus reviews. |
616 |
--- file1\t1970-01-01 00:00:00 +0000 |
617 |
+++ file1\t2005-11-22 00:00:01 +0000 |
|
|
3943.5.6
by Ian Clatworthy
feedback from jam's review |
618 |
@@ -0,0 +1,1 @@
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
619 |
+contents of level0/file1
|
|
3943.5.6
by Ian Clatworthy
feedback from jam's review |
620 |
|
621 |
=== added file 'file2'
|
|
|
4325.4.6
by Vincent Ladeuil
Fixed as per John's and Markus reviews. |
622 |
--- file2\t1970-01-01 00:00:00 +0000 |
623 |
+++ file2\t2005-11-22 00:00:01 +0000 |
|
|
3943.5.6
by Ian Clatworthy
feedback from jam's review |
624 |
@@ -0,0 +1,1 @@
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
625 |
+contents of level0/file2
|
626 |
"""
|
|
627 |
self.check_log(expected, ['-p', '-n0']) |
|
|
3943.5.3
by Ian Clatworthy
add tests |
628 |
|
629 |
def test_log_show_diff_short(self): |
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
630 |
expected = """\ |
|
3943.5.3
by Ian Clatworthy
add tests |
631 |
2 Lorem Ipsum\t2005-11-22 [merge] |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
632 |
merge branch level1
|
|
3943.5.3
by Ian Clatworthy
add tests |
633 |
=== modified file 'file2'
|
|
4325.4.6
by Vincent Ladeuil
Fixed as per John's and Markus reviews. |
634 |
--- file2\t2005-11-22 00:00:01 +0000 |
635 |
+++ file2\t2005-11-22 00:00:02 +0000 |
|
|
3943.5.3
by Ian Clatworthy
add tests |
636 |
@@ -1,1 +1,1 @@
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
637 |
-contents of level0/file2
|
|
3943.5.3
by Ian Clatworthy
add tests |
638 |
+hello
|
639 |
||
640 |
1 Lorem Ipsum\t2005-11-22 |
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
641 |
in branch level0
|
|
3943.5.3
by Ian Clatworthy
add tests |
642 |
=== added file 'file1'
|
|
4325.4.6
by Vincent Ladeuil
Fixed as per John's and Markus reviews. |
643 |
--- file1\t1970-01-01 00:00:00 +0000 |
644 |
+++ file1\t2005-11-22 00:00:01 +0000 |
|
|
3943.5.3
by Ian Clatworthy
add tests |
645 |
@@ -0,0 +1,1 @@
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
646 |
+contents of level0/file1
|
|
4032.1.2
by John Arbash Meinel
Track down a few more files that have trailing whitespace. |
647 |
\x20\x20\x20\x20\x20\x20
|
|
3943.5.3
by Ian Clatworthy
add tests |
648 |
=== added file 'file2'
|
|
4325.4.6
by Vincent Ladeuil
Fixed as per John's and Markus reviews. |
649 |
--- file2\t1970-01-01 00:00:00 +0000 |
650 |
+++ file2\t2005-11-22 00:00:01 +0000 |
|
|
3943.5.3
by Ian Clatworthy
add tests |
651 |
@@ -0,0 +1,1 @@
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
652 |
+contents of level0/file2
|
|
3943.5.3
by Ian Clatworthy
add tests |
653 |
|
|
4221.2.1
by Ian Clatworthy
--include-merges as an alias for --levels 0 in log |
654 |
Use --include-merges or -n0 to see merged revisions.
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
655 |
"""
|
656 |
self.check_log(expected, ['-p', '--short']) |
|
|
3943.5.3
by Ian Clatworthy
add tests |
657 |
|
658 |
def test_log_show_diff_line(self): |
|
659 |
# Not supported by this formatter so expect plain output
|
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
660 |
expected = """\ |
661 |
2: Lorem Ipsum 2005-11-22 [merge] merge branch level1
|
|
662 |
1: Lorem Ipsum 2005-11-22 in branch level0
|
|
663 |
"""
|
|
664 |
self.check_log(expected, ['-p', '--line']) |
|
665 |
||
666 |
def test_log_show_diff_file1(self): |
|
667 |
"""Only the diffs for the given file are to be shown""" |
|
668 |
expected = """\ |
|
669 |
1 Lorem Ipsum\t2005-11-22 |
|
670 |
in branch level0
|
|
671 |
=== added file 'file1'
|
|
|
4325.4.6
by Vincent Ladeuil
Fixed as per John's and Markus reviews. |
672 |
--- file1\t1970-01-01 00:00:00 +0000 |
673 |
+++ file1\t2005-11-22 00:00:01 +0000 |
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
674 |
@@ -0,0 +1,1 @@
|
675 |
+contents of level0/file1
|
|
676 |
||
677 |
"""
|
|
678 |
self.check_log(expected, ['-p', '--short', 'file1']) |
|
679 |
||
680 |
def test_log_show_diff_file2(self): |
|
681 |
"""Only the diffs for the given file are to be shown""" |
|
682 |
expected = """\ |
|
|
3943.5.4
by Ian Clatworthy
filter diff by file |
683 |
2 Lorem Ipsum\t2005-11-22 [merge] |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
684 |
merge branch level1
|
|
3943.5.4
by Ian Clatworthy
filter diff by file |
685 |
=== modified file 'file2'
|
|
4325.4.6
by Vincent Ladeuil
Fixed as per John's and Markus reviews. |
686 |
--- file2\t2005-11-22 00:00:01 +0000 |
687 |
+++ file2\t2005-11-22 00:00:02 +0000 |
|
|
3943.5.4
by Ian Clatworthy
filter diff by file |
688 |
@@ -1,1 +1,1 @@
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
689 |
-contents of level0/file2
|
|
3943.5.4
by Ian Clatworthy
filter diff by file |
690 |
+hello
|
691 |
||
692 |
1 Lorem Ipsum\t2005-11-22 |
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
693 |
in branch level0
|
|
3943.5.4
by Ian Clatworthy
filter diff by file |
694 |
=== added file 'file2'
|
|
4325.4.6
by Vincent Ladeuil
Fixed as per John's and Markus reviews. |
695 |
--- file2\t1970-01-01 00:00:00 +0000 |
696 |
+++ file2\t2005-11-22 00:00:01 +0000 |
|
|
3943.5.4
by Ian Clatworthy
filter diff by file |
697 |
@@ -0,0 +1,1 @@
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
698 |
+contents of level0/file2
|
|
3943.5.4
by Ian Clatworthy
filter diff by file |
699 |
|
|
4221.2.1
by Ian Clatworthy
--include-merges as an alias for --levels 0 in log |
700 |
Use --include-merges or -n0 to see merged revisions.
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
701 |
"""
|
702 |
self.check_log(expected, ['-p', '--short', 'file2']) |
|
703 |
||
704 |
||
705 |
class TestLogUnicodeDiff(TestLog): |
|
|
3943.5.4
by Ian Clatworthy
filter diff by file |
706 |
|
|
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. |
707 |
def test_log_show_diff_non_ascii(self): |
708 |
# Smoke test for bug #328007 UnicodeDecodeError on 'log -p'
|
|
709 |
message = u'Message with \xb5' |
|
710 |
body = 'Body with \xb5\n' |
|
711 |
wt = self.make_branch_and_tree('.') |
|
712 |
self.build_tree_contents([('foo', body)]) |
|
713 |
wt.add('foo') |
|
714 |
wt.commit(message=message) |
|
715 |
# check that command won't fail with unicode error
|
|
716 |
# don't care about exact output because we have other tests for this
|
|
717 |
out,err = self.run_bzr('log -p --long') |
|
718 |
self.assertNotEqual('', out) |
|
719 |
self.assertEqual('', err) |
|
720 |
out,err = self.run_bzr('log -p --short') |
|
721 |
self.assertNotEqual('', out) |
|
722 |
self.assertEqual('', err) |
|
723 |
out,err = self.run_bzr('log -p --line') |
|
724 |
self.assertNotEqual('', out) |
|
725 |
self.assertEqual('', err) |
|
726 |
||
|
3943.5.3
by Ian Clatworthy
add tests |
727 |
|
|
4325.4.3
by Vincent Ladeuil
More cleanups. |
728 |
class TestLogEncodings(tests.TestCaseInTempDir): |
|
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
729 |
|
730 |
_mu = u'\xb5' |
|
731 |
_message = u'Message with \xb5' |
|
732 |
||
733 |
# Encodings which can encode mu
|
|
734 |
good_encodings = [ |
|
735 |
'utf-8', |
|
736 |
'latin-1', |
|
737 |
'iso-8859-1', |
|
738 |
'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. |
739 |
'cp1251', # Russian windows encoding |
|
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
740 |
'cp1258', # Common windows encoding |
741 |
]
|
|
742 |
# Encodings which cannot encode mu
|
|
743 |
bad_encodings = [ |
|
744 |
'ascii', |
|
745 |
'iso-8859-2', |
|
746 |
'koi8_r', |
|
747 |
]
|
|
748 |
||
749 |
def setUp(self): |
|
|
4325.4.3
by Vincent Ladeuil
More cleanups. |
750 |
super(TestLogEncodings, self).setUp() |
|
3224.5.4
by Andrew Bennetts
Fix test suite, mainly weeding out uses of bzrlib.user_encoding. |
751 |
self.user_encoding = osutils._cached_user_encoding |
|
4325.4.3
by Vincent Ladeuil
More cleanups. |
752 |
def restore(): |
753 |
osutils._cached_user_encoding = self.user_encoding |
|
754 |
self.addCleanup(restore) |
|
|
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
755 |
|
756 |
def create_branch(self): |
|
757 |
bzr = self.run_bzr |
|
758 |
bzr('init') |
|
759 |
open('a', 'wb').write('some stuff\n') |
|
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
760 |
bzr('add a') |
761 |
bzr(['commit', '-m', self._message]) |
|
|
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
762 |
|
763 |
def try_encoding(self, encoding, fail=False): |
|
764 |
bzr = self.run_bzr |
|
765 |
if fail: |
|
766 |
self.assertRaises(UnicodeEncodeError, |
|
767 |
self._mu.encode, encoding) |
|
768 |
encoded_msg = self._message.encode(encoding, 'replace') |
|
769 |
else: |
|
770 |
encoded_msg = self._message.encode(encoding) |
|
771 |
||
|
3224.5.4
by Andrew Bennetts
Fix test suite, mainly weeding out uses of bzrlib.user_encoding. |
772 |
old_encoding = osutils._cached_user_encoding |
|
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
773 |
# This test requires that 'run_bzr' uses the current
|
774 |
# bzrlib, because we override user_encoding, and expect
|
|
775 |
# it to be used
|
|
776 |
try: |
|
|
3224.5.4
by Andrew Bennetts
Fix test suite, mainly weeding out uses of bzrlib.user_encoding. |
777 |
osutils._cached_user_encoding = 'ascii' |
|
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
778 |
# We should be able to handle any encoding
|
779 |
out, err = bzr('log', encoding=encoding) |
|
780 |
if not fail: |
|
781 |
# Make sure we wrote mu as we expected it to exist
|
|
782 |
self.assertNotEqual(-1, out.find(encoded_msg)) |
|
783 |
out_unicode = out.decode(encoding) |
|
784 |
self.assertNotEqual(-1, out_unicode.find(self._message)) |
|
785 |
else: |
|
786 |
self.assertNotEqual(-1, out.find('Message with ?')) |
|
787 |
finally: |
|
|
3224.5.4
by Andrew Bennetts
Fix test suite, mainly weeding out uses of bzrlib.user_encoding. |
788 |
osutils._cached_user_encoding = old_encoding |
|
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
789 |
|
790 |
def test_log_handles_encoding(self): |
|
791 |
self.create_branch() |
|
792 |
||
793 |
for encoding in self.good_encodings: |
|
794 |
self.try_encoding(encoding) |
|
795 |
||
796 |
def test_log_handles_bad_encoding(self): |
|
797 |
self.create_branch() |
|
798 |
||
799 |
for encoding in self.bad_encodings: |
|
800 |
self.try_encoding(encoding, fail=True) |
|
801 |
||
802 |
def test_stdout_encoding(self): |
|
803 |
bzr = self.run_bzr |
|
|
3224.5.4
by Andrew Bennetts
Fix test suite, mainly weeding out uses of bzrlib.user_encoding. |
804 |
osutils._cached_user_encoding = "cp1251" |
|
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
805 |
|
806 |
bzr('init') |
|
807 |
self.build_tree(['a']) |
|
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
808 |
bzr('add a') |
809 |
bzr(['commit', '-m', u'\u0422\u0435\u0441\u0442']) |
|
|
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
810 |
stdout, stderr = self.run_bzr('log', encoding='cp866') |
811 |
||
812 |
message = stdout.splitlines()[-1] |
|
813 |
||
814 |
# explanation of the check:
|
|
815 |
# u'\u0422\u0435\u0441\u0442' is word 'Test' in russian
|
|
816 |
# in cp866 encoding this is string '\x92\xa5\xe1\xe2'
|
|
817 |
# in cp1251 encoding this is string '\xd2\xe5\xf1\xf2'
|
|
818 |
# This test should check that output of log command
|
|
819 |
# encoded to sys.stdout.encoding
|
|
820 |
test_in_cp866 = '\x92\xa5\xe1\xe2' |
|
821 |
test_in_cp1251 = '\xd2\xe5\xf1\xf2' |
|
822 |
# Make sure the log string is encoded in cp866
|
|
823 |
self.assertEquals(test_in_cp866, message[2:]) |
|
824 |
# Make sure the cp1251 string is not found anywhere
|
|
825 |
self.assertEquals(-1, stdout.find(test_in_cp1251)) |
|
826 |
||
|
1551.10.18
by Aaron Bentley
Log works in local treeless branches (#84247) |
827 |
|
|
4325.4.3
by Vincent Ladeuil
More cleanups. |
828 |
class TestLogFile(tests.TestCaseWithTransport): |
|
1551.10.18
by Aaron Bentley
Log works in local treeless branches (#84247) |
829 |
|
830 |
def test_log_local_branch_file(self): |
|
831 |
"""We should be able to log files in local treeless branches""" |
|
832 |
tree = self.make_branch_and_tree('tree') |
|
833 |
self.build_tree(['tree/file']) |
|
834 |
tree.add('file') |
|
835 |
tree.commit('revision 1') |
|
836 |
tree.bzrdir.destroy_workingtree() |
|
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
837 |
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. |
838 |
|
|
3943.6.1
by Ian Clatworthy
find file using the end revision |
839 |
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 |
840 |
# 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. |
841 |
tree = self.make_branch_and_tree('parent') |
842 |
self.build_tree(['parent/file1', 'parent/file2', 'parent/file3']) |
|
843 |
tree.add('file1') |
|
844 |
tree.commit('add file1') |
|
845 |
tree.add('file2') |
|
846 |
tree.commit('add file2') |
|
847 |
tree.add('file3') |
|
848 |
tree.commit('add file3') |
|
|
2664.14.1
by Daniel Watkins
Fixed tests.blackbox.test_log to use internals where appropriate. |
849 |
child_tree = tree.bzrdir.sprout('child').open_workingtree() |
850 |
self.build_tree_contents([('child/file2', 'hello')]) |
|
851 |
child_tree.commit(message='branch 1') |
|
852 |
tree.merge_from_branch(child_tree.branch) |
|
853 |
tree.commit(message='merge child branch') |
|
|
3943.6.1
by Ian Clatworthy
find file using the end revision |
854 |
if complex: |
|
3943.6.3
by Ian Clatworthy
search the start tree if the end tree doesn't have a file |
855 |
tree.remove('file2') |
856 |
tree.commit('remove file2') |
|
857 |
tree.rename_one('file3', 'file4') |
|
858 |
tree.commit('file3 is now called file4') |
|
|
3943.6.1
by Ian Clatworthy
find file using the end revision |
859 |
tree.remove('file1') |
|
3943.6.3
by Ian Clatworthy
search the start tree if the end tree doesn't have a file |
860 |
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. |
861 |
os.chdir('parent') |
|
3940.1.2
by Ian Clatworthy
add test |
862 |
|
863 |
def test_log_file(self): |
|
864 |
"""The log for a particular file should only list revs for that file""" |
|
865 |
self.prepare_tree() |
|
|
4206.1.1
by Ian Clatworthy
log mainline by default |
866 |
log = self.run_bzr('log -n0 file1')[0] |
|
2359.1.1
by Kent Gibson
Fix ``bzr log <file>`` so it only logs the revisions that changed the file, and does it faster. |
867 |
self.assertContainsRe(log, 'revno: 1\n') |
868 |
self.assertNotContainsRe(log, 'revno: 2\n') |
|
869 |
self.assertNotContainsRe(log, 'revno: 3\n') |
|
870 |
self.assertNotContainsRe(log, 'revno: 3.1.1\n') |
|
|
4208.2.1
by Ian Clatworthy
merge indicators in log --long |
871 |
self.assertNotContainsRe(log, 'revno: 4 ') |
|
4206.1.1
by Ian Clatworthy
log mainline by default |
872 |
log = self.run_bzr('log -n0 file2')[0] |
|
2359.1.1
by Kent Gibson
Fix ``bzr log <file>`` so it only logs the revisions that changed the file, and does it faster. |
873 |
self.assertNotContainsRe(log, 'revno: 1\n') |
874 |
self.assertContainsRe(log, 'revno: 2\n') |
|
875 |
self.assertNotContainsRe(log, 'revno: 3\n') |
|
876 |
self.assertContainsRe(log, 'revno: 3.1.1\n') |
|
|
4208.2.1
by Ian Clatworthy
merge indicators in log --long |
877 |
self.assertContainsRe(log, 'revno: 4 ') |
|
4206.1.1
by Ian Clatworthy
log mainline by default |
878 |
log = self.run_bzr('log -n0 file3')[0] |
|
2359.1.1
by Kent Gibson
Fix ``bzr log <file>`` so it only logs the revisions that changed the file, and does it faster. |
879 |
self.assertNotContainsRe(log, 'revno: 1\n') |
880 |
self.assertNotContainsRe(log, 'revno: 2\n') |
|
881 |
self.assertContainsRe(log, 'revno: 3\n') |
|
882 |
self.assertNotContainsRe(log, 'revno: 3.1.1\n') |
|
|
4208.2.1
by Ian Clatworthy
merge indicators in log --long |
883 |
self.assertNotContainsRe(log, 'revno: 4 ') |
|
4206.1.1
by Ian Clatworthy
log mainline by default |
884 |
log = self.run_bzr('log -n0 -r3.1.1 file2')[0] |
|
2466.12.1
by Kent Gibson
Fix ``bzr log -r`` to support selecting merge revisions. |
885 |
self.assertNotContainsRe(log, 'revno: 1\n') |
886 |
self.assertNotContainsRe(log, 'revno: 2\n') |
|
887 |
self.assertNotContainsRe(log, 'revno: 3\n') |
|
888 |
self.assertContainsRe(log, 'revno: 3.1.1\n') |
|
|
4208.2.1
by Ian Clatworthy
merge indicators in log --long |
889 |
self.assertNotContainsRe(log, 'revno: 4 ') |
|
4206.1.1
by Ian Clatworthy
log mainline by default |
890 |
log = self.run_bzr('log -n0 -r4 file2')[0] |
891 |
self.assertNotContainsRe(log, 'revno: 1\n') |
|
892 |
self.assertNotContainsRe(log, 'revno: 2\n') |
|
893 |
self.assertNotContainsRe(log, 'revno: 3\n') |
|
|
4511.3.11
by Marius Kruger
* fix tests again |
894 |
self.assertContainsRe(log, 'revno: 3.1.1\n') |
|
4214.1.1
by Ian Clatworthy
log mainline only by default (Ian Clatworthy) |
895 |
self.assertContainsRe(log, 'revno: 4 ') |
|
4206.1.1
by Ian Clatworthy
log mainline by default |
896 |
log = self.run_bzr('log -n0 -r3.. file2')[0] |
897 |
self.assertNotContainsRe(log, 'revno: 1\n') |
|
898 |
self.assertNotContainsRe(log, 'revno: 2\n') |
|
899 |
self.assertNotContainsRe(log, 'revno: 3\n') |
|
900 |
self.assertContainsRe(log, 'revno: 3.1.1\n') |
|
|
4214.1.1
by Ian Clatworthy
log mainline only by default (Ian Clatworthy) |
901 |
self.assertContainsRe(log, 'revno: 4 ') |
|
4206.1.1
by Ian Clatworthy
log mainline by default |
902 |
log = self.run_bzr('log -n0 -r..3 file2')[0] |
|
2466.12.1
by Kent Gibson
Fix ``bzr log -r`` to support selecting merge revisions. |
903 |
self.assertNotContainsRe(log, 'revno: 1\n') |
904 |
self.assertContainsRe(log, 'revno: 2\n') |
|
905 |
self.assertNotContainsRe(log, 'revno: 3\n') |
|
906 |
self.assertNotContainsRe(log, 'revno: 3.1.1\n') |
|
|
4208.2.1
by Ian Clatworthy
merge indicators in log --long |
907 |
self.assertNotContainsRe(log, 'revno: 4 ') |
|
3940.1.2
by Ian Clatworthy
add test |
908 |
|
|
3943.6.4
by Ian Clatworthy
review feedback from vila |
909 |
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 |
910 |
# Check logging a deleted file gives an error if the
|
911 |
# file isn't found at the end or start of the revision range
|
|
|
3943.6.4
by Ian Clatworthy
review feedback from vila |
912 |
self.prepare_tree(complex=True) |
|
3943.6.3
by Ian Clatworthy
search the start tree if the end tree doesn't have a file |
913 |
err_msg = "Path unknown at end or start of revision range: file2" |
914 |
err = self.run_bzr('log file2', retcode=3)[1] |
|
|
3943.6.1
by Ian Clatworthy
find file using the end revision |
915 |
self.assertContainsRe(err, err_msg) |
916 |
||
|
3943.6.4
by Ian Clatworthy
review feedback from vila |
917 |
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 |
918 |
# Check logging a deleted file is ok if the file existed
|
919 |
# at the end the revision range
|
|
|
3943.6.4
by Ian Clatworthy
review feedback from vila |
920 |
self.prepare_tree(complex=True) |
|
4206.1.1
by Ian Clatworthy
log mainline by default |
921 |
log, err = self.run_bzr('log -n0 -r..4 file2') |
|
3943.6.3
by Ian Clatworthy
search the start tree if the end tree doesn't have a file |
922 |
self.assertEquals('', err) |
923 |
self.assertNotContainsRe(log, 'revno: 1\n') |
|
924 |
self.assertContainsRe(log, 'revno: 2\n') |
|
925 |
self.assertNotContainsRe(log, 'revno: 3\n') |
|
926 |
self.assertContainsRe(log, 'revno: 3.1.1\n') |
|
|
4208.2.1
by Ian Clatworthy
merge indicators in log --long |
927 |
self.assertContainsRe(log, 'revno: 4 ') |
|
3943.6.3
by Ian Clatworthy
search the start tree if the end tree doesn't have a file |
928 |
|
|
3943.6.4
by Ian Clatworthy
review feedback from vila |
929 |
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 |
930 |
# Check logging a deleted file is ok if the file existed
|
931 |
# at the start of the revision range
|
|
|
3943.6.4
by Ian Clatworthy
review feedback from vila |
932 |
self.prepare_tree(complex=True) |
|
3943.6.3
by Ian Clatworthy
search the start tree if the end tree doesn't have a file |
933 |
log, err = self.run_bzr('log file1') |
934 |
self.assertEquals('', err) |
|
|
3943.6.1
by Ian Clatworthy
find file using the end revision |
935 |
self.assertContainsRe(log, 'revno: 1\n') |
936 |
self.assertNotContainsRe(log, 'revno: 2\n') |
|
937 |
self.assertNotContainsRe(log, 'revno: 3\n') |
|
938 |
self.assertNotContainsRe(log, 'revno: 3.1.1\n') |
|
|
4208.2.1
by Ian Clatworthy
merge indicators in log --long |
939 |
self.assertNotContainsRe(log, 'revno: 4 ') |
|
3943.6.1
by Ian Clatworthy
find file using the end revision |
940 |
|
941 |
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 |
942 |
"""File matched against revision range, not current tree.""" |
|
3943.6.1
by Ian Clatworthy
find file using the end revision |
943 |
self.prepare_tree(complex=True) |
|
3943.6.3
by Ian Clatworthy
search the start tree if the end tree doesn't have a file |
944 |
|
|
3943.6.1
by Ian Clatworthy
find file using the end revision |
945 |
# 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 |
946 |
err_msg = "Path unknown at end or start of revision range: file3" |
|
3943.6.1
by Ian Clatworthy
find file using the end revision |
947 |
err = self.run_bzr('log file3', retcode=3)[1] |
948 |
self.assertContainsRe(err, err_msg) |
|
949 |
||
950 |
# Check we can see a renamed file if we give the right end revision
|
|
|
3943.6.3
by Ian Clatworthy
search the start tree if the end tree doesn't have a file |
951 |
log, err = self.run_bzr('log -r..4 file3') |
952 |
self.assertEquals('', err) |
|
|
3943.6.1
by Ian Clatworthy
find file using the end revision |
953 |
self.assertNotContainsRe(log, 'revno: 1\n') |
954 |
self.assertNotContainsRe(log, 'revno: 2\n') |
|
955 |
self.assertContainsRe(log, 'revno: 3\n') |
|
956 |
self.assertNotContainsRe(log, 'revno: 3.1.1\n') |
|
|
4208.2.1
by Ian Clatworthy
merge indicators in log --long |
957 |
self.assertNotContainsRe(log, 'revno: 4 ') |
|
3943.6.1
by Ian Clatworthy
find file using the end revision |
958 |
|
|
3940.1.2
by Ian Clatworthy
add test |
959 |
def test_line_log_file(self): |
960 |
"""The line log for a file should only list relevant mainline revs""" |
|
961 |
# Note: this also implicitly covers the short logging case.
|
|
962 |
# We test using --line in preference to --short because matching
|
|
963 |
# revnos in the output of --line is more reliable.
|
|
964 |
self.prepare_tree() |
|
|
3940.1.5
by Ian Clatworthy
feedback from vila |
965 |
|
966 |
# full history of file1
|
|
|
3940.1.2
by Ian Clatworthy
add test |
967 |
log = self.run_bzr('log --line file1')[0] |
968 |
self.assertContainsRe(log, '^1:', re.MULTILINE) |
|
969 |
self.assertNotContainsRe(log, '^2:', re.MULTILINE) |
|
970 |
self.assertNotContainsRe(log, '^3:', re.MULTILINE) |
|
971 |
self.assertNotContainsRe(log, '^3.1.1:', re.MULTILINE) |
|
972 |
self.assertNotContainsRe(log, '^4:', re.MULTILINE) |
|
|
3940.1.5
by Ian Clatworthy
feedback from vila |
973 |
|
974 |
# full history of file2
|
|
|
3940.1.2
by Ian Clatworthy
add test |
975 |
log = self.run_bzr('log --line file2')[0] |
976 |
self.assertNotContainsRe(log, '^1:', re.MULTILINE) |
|
977 |
self.assertContainsRe(log, '^2:', re.MULTILINE) |
|
978 |
self.assertNotContainsRe(log, '^3:', re.MULTILINE) |
|
979 |
self.assertNotContainsRe(log, '^3.1.1:', re.MULTILINE) |
|
980 |
self.assertContainsRe(log, '^4:', re.MULTILINE) |
|
|
3940.1.5
by Ian Clatworthy
feedback from vila |
981 |
|
982 |
# full history of file3
|
|
|
3940.1.2
by Ian Clatworthy
add test |
983 |
log = self.run_bzr('log --line file3')[0] |
984 |
self.assertNotContainsRe(log, '^1:', re.MULTILINE) |
|
985 |
self.assertNotContainsRe(log, '^2:', re.MULTILINE) |
|
986 |
self.assertContainsRe(log, '^3:', re.MULTILINE) |
|
987 |
self.assertNotContainsRe(log, '^3.1.1:', re.MULTILINE) |
|
988 |
self.assertNotContainsRe(log, '^4:', re.MULTILINE) |
|
|
3940.1.5
by Ian Clatworthy
feedback from vila |
989 |
|
990 |
# file in a merge revision
|
|
|
3940.1.2
by Ian Clatworthy
add test |
991 |
log = self.run_bzr('log --line -r3.1.1 file2')[0] |
992 |
self.assertNotContainsRe(log, '^1:', re.MULTILINE) |
|
993 |
self.assertNotContainsRe(log, '^2:', re.MULTILINE) |
|
994 |
self.assertNotContainsRe(log, '^3:', re.MULTILINE) |
|
995 |
self.assertContainsRe(log, '^3.1.1:', re.MULTILINE) |
|
996 |
self.assertNotContainsRe(log, '^4:', re.MULTILINE) |
|
|
3940.1.5
by Ian Clatworthy
feedback from vila |
997 |
|
998 |
# file in a mainline revision
|
|
|
3940.1.2
by Ian Clatworthy
add test |
999 |
log = self.run_bzr('log --line -r4 file2')[0] |
1000 |
self.assertNotContainsRe(log, '^1:', re.MULTILINE) |
|
1001 |
self.assertNotContainsRe(log, '^2:', re.MULTILINE) |
|
1002 |
self.assertNotContainsRe(log, '^3:', re.MULTILINE) |
|
1003 |
self.assertNotContainsRe(log, '^3.1.1:', re.MULTILINE) |
|
1004 |
self.assertContainsRe(log, '^4:', re.MULTILINE) |
|
|
3940.1.5
by Ian Clatworthy
feedback from vila |
1005 |
|
1006 |
# file since a revision
|
|
|
3940.1.2
by Ian Clatworthy
add test |
1007 |
log = self.run_bzr('log --line -r3.. file2')[0] |
1008 |
self.assertNotContainsRe(log, '^1:', re.MULTILINE) |
|
1009 |
self.assertNotContainsRe(log, '^2:', re.MULTILINE) |
|
1010 |
self.assertNotContainsRe(log, '^3:', re.MULTILINE) |
|
1011 |
self.assertNotContainsRe(log, '^3.1.1:', re.MULTILINE) |
|
1012 |
self.assertContainsRe(log, '^4:', re.MULTILINE) |
|
|
3940.1.5
by Ian Clatworthy
feedback from vila |
1013 |
|
1014 |
# file up to a revision
|
|
|
3940.1.2
by Ian Clatworthy
add test |
1015 |
log = self.run_bzr('log --line -r..3 file2')[0] |
1016 |
self.assertNotContainsRe(log, '^1:', re.MULTILINE) |
|
1017 |
self.assertContainsRe(log, '^2:', re.MULTILINE) |
|
1018 |
self.assertNotContainsRe(log, '^3:', re.MULTILINE) |
|
1019 |
self.assertNotContainsRe(log, '^3.1.1:', re.MULTILINE) |
|
1020 |
self.assertNotContainsRe(log, '^4:', re.MULTILINE) |
|
|
4202.2.1
by Ian Clatworthy
get directory logging working again |
1021 |
|
1022 |
||
|
4325.4.3
by Vincent Ladeuil
More cleanups. |
1023 |
class TestLogMultiple(tests.TestCaseWithTransport): |
|
4202.2.1
by Ian Clatworthy
get directory logging working again |
1024 |
|
1025 |
def prepare_tree(self): |
|
1026 |
tree = self.make_branch_and_tree('parent') |
|
1027 |
self.build_tree([ |
|
1028 |
'parent/file1', |
|
1029 |
'parent/file2', |
|
1030 |
'parent/dir1/', |
|
1031 |
'parent/dir1/file5', |
|
1032 |
'parent/dir1/dir2/', |
|
1033 |
'parent/dir1/dir2/file3', |
|
1034 |
'parent/file4']) |
|
1035 |
tree.add('file1') |
|
|
4202.2.2
by Ian Clatworthy
improve signal-to-noise ratio in tests |
1036 |
tree.commit('add file1') |
|
4202.2.1
by Ian Clatworthy
get directory logging working again |
1037 |
tree.add('file2') |
|
4202.2.2
by Ian Clatworthy
improve signal-to-noise ratio in tests |
1038 |
tree.commit('add file2') |
|
4202.2.1
by Ian Clatworthy
get directory logging working again |
1039 |
tree.add(['dir1', 'dir1/dir2', 'dir1/dir2/file3']) |
|
4202.2.2
by Ian Clatworthy
improve signal-to-noise ratio in tests |
1040 |
tree.commit('add file3') |
|
4202.2.1
by Ian Clatworthy
get directory logging working again |
1041 |
tree.add('file4') |
|
4202.2.2
by Ian Clatworthy
improve signal-to-noise ratio in tests |
1042 |
tree.commit('add file4') |
|
4202.2.1
by Ian Clatworthy
get directory logging working again |
1043 |
tree.add('dir1/file5') |
|
4202.2.2
by Ian Clatworthy
improve signal-to-noise ratio in tests |
1044 |
tree.commit('add file5') |
|
4202.2.1
by Ian Clatworthy
get directory logging working again |
1045 |
child_tree = tree.bzrdir.sprout('child').open_workingtree() |
1046 |
self.build_tree_contents([('child/file2', 'hello')]) |
|
|
4202.2.2
by Ian Clatworthy
improve signal-to-noise ratio in tests |
1047 |
child_tree.commit(message='branch 1') |
|
4202.2.1
by Ian Clatworthy
get directory logging working again |
1048 |
tree.merge_from_branch(child_tree.branch) |
|
4202.2.2
by Ian Clatworthy
improve signal-to-noise ratio in tests |
1049 |
tree.commit(message='merge child branch') |
|
4202.2.1
by Ian Clatworthy
get directory logging working again |
1050 |
os.chdir('parent') |
1051 |
||
|
4202.2.2
by Ian Clatworthy
improve signal-to-noise ratio in tests |
1052 |
def assertRevnos(self, paths_str, expected_revnos): |
1053 |
# confirm the revision numbers in log --line output are those expected
|
|
1054 |
out, err = self.run_bzr('log --line -n0 %s' % (paths_str,)) |
|
1055 |
self.assertEqual('', err) |
|
1056 |
revnos = [s.split(':', 1)[0].lstrip() for s in out.splitlines()] |
|
|
4202.2.5
by Ian Clatworthy
apply review tweaks & update help |
1057 |
self.assertEqual(expected_revnos, revnos) |
|
4202.2.2
by Ian Clatworthy
improve signal-to-noise ratio in tests |
1058 |
|
|
4202.2.1
by Ian Clatworthy
get directory logging working again |
1059 |
def test_log_files(self): |
1060 |
"""The log for multiple file should only list revs for those files""" |
|
1061 |
self.prepare_tree() |
|
|
4202.2.2
by Ian Clatworthy
improve signal-to-noise ratio in tests |
1062 |
self.assertRevnos('file1 file2 dir1/dir2/file3', |
1063 |
['6', '5.1.1', '3', '2', '1']) |
|
|
4202.2.1
by Ian Clatworthy
get directory logging working again |
1064 |
|
1065 |
def test_log_directory(self): |
|
1066 |
"""The log for a directory should show all nested files.""" |
|
1067 |
self.prepare_tree() |
|
|
4202.2.2
by Ian Clatworthy
improve signal-to-noise ratio in tests |
1068 |
self.assertRevnos('dir1', ['5', '3']) |
|
4202.2.1
by Ian Clatworthy
get directory logging working again |
1069 |
|
1070 |
def test_log_nested_directory(self): |
|
1071 |
"""The log for a directory should show all nested files.""" |
|
1072 |
self.prepare_tree() |
|
|
4202.2.2
by Ian Clatworthy
improve signal-to-noise ratio in tests |
1073 |
self.assertRevnos('dir1/dir2', ['3']) |
|
4202.2.1
by Ian Clatworthy
get directory logging working again |
1074 |
|
1075 |
def test_log_in_nested_directory(self): |
|
1076 |
"""The log for a directory should show all nested files.""" |
|
1077 |
self.prepare_tree() |
|
1078 |
os.chdir("dir1") |
|
|
4202.2.2
by Ian Clatworthy
improve signal-to-noise ratio in tests |
1079 |
self.assertRevnos('.', ['5', '3']) |
|
4202.2.1
by Ian Clatworthy
get directory logging working again |
1080 |
|
1081 |
def test_log_files_and_directories(self): |
|
1082 |
"""Logging files and directories together should be fine.""" |
|
1083 |
self.prepare_tree() |
|
|
4202.2.2
by Ian Clatworthy
improve signal-to-noise ratio in tests |
1084 |
self.assertRevnos('file4 dir1/dir2', ['4', '3']) |
|
4202.2.1
by Ian Clatworthy
get directory logging working again |
1085 |
|
1086 |
def test_log_files_and_dirs_in_nested_directory(self): |
|
1087 |
"""The log for a directory should show all nested files.""" |
|
1088 |
self.prepare_tree() |
|
1089 |
os.chdir("dir1") |
|
|
4202.2.2
by Ian Clatworthy
improve signal-to-noise ratio in tests |
1090 |
self.assertRevnos('dir2 file5', ['5', '3']) |