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') |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
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
|
|
2978.6.1
by Kent Gibson
Use normalize_log to more accurately test blackbox log output. |
503 |
------------------------------------------------------------
|
|
3170.3.4
by John Arbash Meinel
Update the tests for the new revision numbering. |
504 |
revno: 1.2.1
|
|
2978.6.1
by Kent Gibson
Use normalize_log to more accurately test blackbox log output. |
505 |
committer: Lorem Ipsum <test@example.com>
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
506 |
branch nick: level2
|
|
2978.6.1
by Kent Gibson
Use normalize_log to more accurately test blackbox log output. |
507 |
timestamp: Just now
|
508 |
message:
|
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
509 |
in branch level2
|
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 |
||
539 |
||
540 |
class TestLogDiff(TestLog): |
|
541 |
||
542 |
def setUp(self): |
|
543 |
super(TestLogDiff, self).setUp() |
|
544 |
self.make_branch_with_diffs() |
|
545 |
||
546 |
def make_branch_with_diffs(self): |
|
547 |
level0 = self.make_branch_and_tree('level0') |
|
548 |
self.build_tree(['level0/file1', 'level0/file2']) |
|
549 |
level0.add('file1') |
|
550 |
level0.add('file2') |
|
551 |
level0.commit(message='in branch level0', **self.commit_options()) |
|
552 |
||
553 |
level1 = level0.bzrdir.sprout('level1').open_workingtree() |
|
554 |
self.build_tree_contents([('level1/file2', 'hello\n')]) |
|
555 |
level1.commit(message='in branch level1', **self.commit_options()) |
|
556 |
level0.merge_from_branch(level1.branch) |
|
557 |
level0.commit(message='merge branch level1', **self.commit_options()) |
|
|
3943.5.3
by Ian Clatworthy
add tests |
558 |
|
|
4206.1.1
by Ian Clatworthy
log mainline by default |
559 |
def test_log_show_diff_long_with_merges(self): |
560 |
out,err = self.run_bzr('log -p -n0') |
|
|
3943.5.3
by Ian Clatworthy
add tests |
561 |
self.assertEqual('', err) |
|
4325.4.3
by Vincent Ladeuil
More cleanups. |
562 |
log = test_log.normalize_log(out) |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
563 |
expected = """\ |
|
3943.5.3
by Ian Clatworthy
add tests |
564 |
------------------------------------------------------------
|
|
4208.2.1
by Ian Clatworthy
merge indicators in log --long |
565 |
revno: 2 [merge]
|
|
3943.5.3
by Ian Clatworthy
add tests |
566 |
committer: Lorem Ipsum <test@example.com>
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
567 |
branch nick: level0
|
|
3943.5.3
by Ian Clatworthy
add tests |
568 |
timestamp: Just now
|
569 |
message:
|
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
570 |
merge branch level1
|
|
3943.5.3
by Ian Clatworthy
add tests |
571 |
diff:
|
|
3943.5.6
by Ian Clatworthy
feedback from jam's review |
572 |
=== modified file 'file2'
|
|
4325.4.6
by Vincent Ladeuil
Fixed as per John's and Markus reviews. |
573 |
--- file2\t2005-11-22 00:00:01 +0000 |
574 |
+++ file2\t2005-11-22 00:00:02 +0000 |
|
|
3943.5.6
by Ian Clatworthy
feedback from jam's review |
575 |
@@ -1,1 +1,1 @@
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
576 |
-contents of level0/file2
|
|
3943.5.6
by Ian Clatworthy
feedback from jam's review |
577 |
+hello
|
|
3943.5.3
by Ian Clatworthy
add tests |
578 |
------------------------------------------------------------
|
579 |
revno: 1.1.1
|
|
580 |
committer: Lorem Ipsum <test@example.com>
|
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
581 |
branch nick: level1
|
|
3943.5.3
by Ian Clatworthy
add tests |
582 |
timestamp: Just now
|
583 |
message:
|
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
584 |
in branch level1
|
|
3943.5.3
by Ian Clatworthy
add tests |
585 |
diff:
|
|
3943.5.6
by Ian Clatworthy
feedback from jam's review |
586 |
=== modified file 'file2'
|
|
4325.4.6
by Vincent Ladeuil
Fixed as per John's and Markus reviews. |
587 |
--- file2\t2005-11-22 00:00:01 +0000 |
588 |
+++ file2\t2005-11-22 00:00:02 +0000 |
|
|
3943.5.6
by Ian Clatworthy
feedback from jam's review |
589 |
@@ -1,1 +1,1 @@
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
590 |
-contents of level0/file2
|
|
3943.5.6
by Ian Clatworthy
feedback from jam's review |
591 |
+hello
|
|
3943.5.3
by Ian Clatworthy
add tests |
592 |
------------------------------------------------------------
|
593 |
revno: 1
|
|
594 |
committer: Lorem Ipsum <test@example.com>
|
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
595 |
branch nick: level0
|
|
3943.5.3
by Ian Clatworthy
add tests |
596 |
timestamp: Just now
|
597 |
message:
|
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
598 |
in branch level0
|
|
3943.5.3
by Ian Clatworthy
add tests |
599 |
diff:
|
|
3943.5.6
by Ian Clatworthy
feedback from jam's review |
600 |
=== added file 'file1'
|
|
4325.4.6
by Vincent Ladeuil
Fixed as per John's and Markus reviews. |
601 |
--- file1\t1970-01-01 00:00:00 +0000 |
602 |
+++ file1\t2005-11-22 00:00:01 +0000 |
|
|
3943.5.6
by Ian Clatworthy
feedback from jam's review |
603 |
@@ -0,0 +1,1 @@
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
604 |
+contents of level0/file1
|
|
3943.5.6
by Ian Clatworthy
feedback from jam's review |
605 |
|
606 |
=== added file 'file2'
|
|
|
4325.4.6
by Vincent Ladeuil
Fixed as per John's and Markus reviews. |
607 |
--- file2\t1970-01-01 00:00:00 +0000 |
608 |
+++ file2\t2005-11-22 00:00:01 +0000 |
|
|
3943.5.6
by Ian Clatworthy
feedback from jam's review |
609 |
@@ -0,0 +1,1 @@
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
610 |
+contents of level0/file2
|
611 |
"""
|
|
612 |
self.check_log(expected, ['-p', '-n0']) |
|
|
3943.5.3
by Ian Clatworthy
add tests |
613 |
|
614 |
def test_log_show_diff_short(self): |
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
615 |
expected = """\ |
|
3943.5.3
by Ian Clatworthy
add tests |
616 |
2 Lorem Ipsum\t2005-11-22 [merge] |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
617 |
merge branch level1
|
|
3943.5.3
by Ian Clatworthy
add tests |
618 |
=== modified file 'file2'
|
|
4325.4.6
by Vincent Ladeuil
Fixed as per John's and Markus reviews. |
619 |
--- file2\t2005-11-22 00:00:01 +0000 |
620 |
+++ file2\t2005-11-22 00:00:02 +0000 |
|
|
3943.5.3
by Ian Clatworthy
add tests |
621 |
@@ -1,1 +1,1 @@
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
622 |
-contents of level0/file2
|
|
3943.5.3
by Ian Clatworthy
add tests |
623 |
+hello
|
624 |
||
625 |
1 Lorem Ipsum\t2005-11-22 |
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
626 |
in branch level0
|
|
3943.5.3
by Ian Clatworthy
add tests |
627 |
=== added file 'file1'
|
|
4325.4.6
by Vincent Ladeuil
Fixed as per John's and Markus reviews. |
628 |
--- file1\t1970-01-01 00:00:00 +0000 |
629 |
+++ file1\t2005-11-22 00:00:01 +0000 |
|
|
3943.5.3
by Ian Clatworthy
add tests |
630 |
@@ -0,0 +1,1 @@
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
631 |
+contents of level0/file1
|
|
4032.1.2
by John Arbash Meinel
Track down a few more files that have trailing whitespace. |
632 |
\x20\x20\x20\x20\x20\x20
|
|
3943.5.3
by Ian Clatworthy
add tests |
633 |
=== added file 'file2'
|
|
4325.4.6
by Vincent Ladeuil
Fixed as per John's and Markus reviews. |
634 |
--- file2\t1970-01-01 00:00:00 +0000 |
635 |
+++ file2\t2005-11-22 00:00:01 +0000 |
|
|
3943.5.3
by Ian Clatworthy
add tests |
636 |
@@ -0,0 +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 |
|
|
4221.2.1
by Ian Clatworthy
--include-merges as an alias for --levels 0 in log |
639 |
Use --include-merges or -n0 to see merged revisions.
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
640 |
"""
|
641 |
self.check_log(expected, ['-p', '--short']) |
|
|
3943.5.3
by Ian Clatworthy
add tests |
642 |
|
643 |
def test_log_show_diff_line(self): |
|
644 |
# Not supported by this formatter so expect plain output
|
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
645 |
expected = """\ |
646 |
2: Lorem Ipsum 2005-11-22 [merge] merge branch level1
|
|
647 |
1: Lorem Ipsum 2005-11-22 in branch level0
|
|
648 |
"""
|
|
649 |
self.check_log(expected, ['-p', '--line']) |
|
650 |
||
651 |
def test_log_show_diff_file1(self): |
|
652 |
"""Only the diffs for the given file are to be shown""" |
|
653 |
expected = """\ |
|
654 |
1 Lorem Ipsum\t2005-11-22 |
|
655 |
in branch level0
|
|
656 |
=== added file 'file1'
|
|
|
4325.4.6
by Vincent Ladeuil
Fixed as per John's and Markus reviews. |
657 |
--- file1\t1970-01-01 00:00:00 +0000 |
658 |
+++ file1\t2005-11-22 00:00:01 +0000 |
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
659 |
@@ -0,0 +1,1 @@
|
660 |
+contents of level0/file1
|
|
661 |
||
662 |
"""
|
|
663 |
self.check_log(expected, ['-p', '--short', 'file1']) |
|
664 |
||
665 |
def test_log_show_diff_file2(self): |
|
666 |
"""Only the diffs for the given file are to be shown""" |
|
667 |
expected = """\ |
|
|
3943.5.4
by Ian Clatworthy
filter diff by file |
668 |
2 Lorem Ipsum\t2005-11-22 [merge] |
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
669 |
merge branch level1
|
|
3943.5.4
by Ian Clatworthy
filter diff by file |
670 |
=== modified file 'file2'
|
|
4325.4.6
by Vincent Ladeuil
Fixed as per John's and Markus reviews. |
671 |
--- file2\t2005-11-22 00:00:01 +0000 |
672 |
+++ file2\t2005-11-22 00:00:02 +0000 |
|
|
3943.5.4
by Ian Clatworthy
filter diff by file |
673 |
@@ -1,1 +1,1 @@
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
674 |
-contents of level0/file2
|
|
3943.5.4
by Ian Clatworthy
filter diff by file |
675 |
+hello
|
676 |
||
677 |
1 Lorem Ipsum\t2005-11-22 |
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
678 |
in branch level0
|
|
3943.5.4
by Ian Clatworthy
filter diff by file |
679 |
=== added file 'file2'
|
|
4325.4.6
by Vincent Ladeuil
Fixed as per John's and Markus reviews. |
680 |
--- file2\t1970-01-01 00:00:00 +0000 |
681 |
+++ file2\t2005-11-22 00:00:01 +0000 |
|
|
3943.5.4
by Ian Clatworthy
filter diff by file |
682 |
@@ -0,0 +1,1 @@
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
683 |
+contents of level0/file2
|
|
3943.5.4
by Ian Clatworthy
filter diff by file |
684 |
|
|
4221.2.1
by Ian Clatworthy
--include-merges as an alias for --levels 0 in log |
685 |
Use --include-merges or -n0 to see merged revisions.
|
|
4325.4.5
by Vincent Ladeuil
Some cleanup in blackbox log tests. |
686 |
"""
|
687 |
self.check_log(expected, ['-p', '--short', 'file2']) |
|
688 |
||
689 |
||
690 |
class TestLogUnicodeDiff(TestLog): |
|
|
3943.5.4
by Ian Clatworthy
filter diff by file |
691 |
|
|
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. |
692 |
def test_log_show_diff_non_ascii(self): |
693 |
# Smoke test for bug #328007 UnicodeDecodeError on 'log -p'
|
|
694 |
message = u'Message with \xb5' |
|
695 |
body = 'Body with \xb5\n' |
|
696 |
wt = self.make_branch_and_tree('.') |
|
697 |
self.build_tree_contents([('foo', body)]) |
|
698 |
wt.add('foo') |
|
699 |
wt.commit(message=message) |
|
700 |
# check that command won't fail with unicode error
|
|
701 |
# don't care about exact output because we have other tests for this
|
|
702 |
out,err = self.run_bzr('log -p --long') |
|
703 |
self.assertNotEqual('', out) |
|
704 |
self.assertEqual('', err) |
|
705 |
out,err = self.run_bzr('log -p --short') |
|
706 |
self.assertNotEqual('', out) |
|
707 |
self.assertEqual('', err) |
|
708 |
out,err = self.run_bzr('log -p --line') |
|
709 |
self.assertNotEqual('', out) |
|
710 |
self.assertEqual('', err) |
|
711 |
||
|
3943.5.3
by Ian Clatworthy
add tests |
712 |
|
|
4325.4.3
by Vincent Ladeuil
More cleanups. |
713 |
class TestLogEncodings(tests.TestCaseInTempDir): |
|
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
714 |
|
715 |
_mu = u'\xb5' |
|
716 |
_message = u'Message with \xb5' |
|
717 |
||
718 |
# Encodings which can encode mu
|
|
719 |
good_encodings = [ |
|
720 |
'utf-8', |
|
721 |
'latin-1', |
|
722 |
'iso-8859-1', |
|
723 |
'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. |
724 |
'cp1251', # Russian windows encoding |
|
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
725 |
'cp1258', # Common windows encoding |
726 |
]
|
|
727 |
# Encodings which cannot encode mu
|
|
728 |
bad_encodings = [ |
|
729 |
'ascii', |
|
730 |
'iso-8859-2', |
|
731 |
'koi8_r', |
|
732 |
]
|
|
733 |
||
734 |
def setUp(self): |
|
|
4325.4.3
by Vincent Ladeuil
More cleanups. |
735 |
super(TestLogEncodings, self).setUp() |
|
3224.5.4
by Andrew Bennetts
Fix test suite, mainly weeding out uses of bzrlib.user_encoding. |
736 |
self.user_encoding = osutils._cached_user_encoding |
|
4325.4.3
by Vincent Ladeuil
More cleanups. |
737 |
def restore(): |
738 |
osutils._cached_user_encoding = self.user_encoding |
|
739 |
self.addCleanup(restore) |
|
|
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
740 |
|
741 |
def create_branch(self): |
|
742 |
bzr = self.run_bzr |
|
743 |
bzr('init') |
|
744 |
open('a', 'wb').write('some stuff\n') |
|
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
745 |
bzr('add a') |
746 |
bzr(['commit', '-m', self._message]) |
|
|
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
747 |
|
748 |
def try_encoding(self, encoding, fail=False): |
|
749 |
bzr = self.run_bzr |
|
750 |
if fail: |
|
751 |
self.assertRaises(UnicodeEncodeError, |
|
752 |
self._mu.encode, encoding) |
|
753 |
encoded_msg = self._message.encode(encoding, 'replace') |
|
754 |
else: |
|
755 |
encoded_msg = self._message.encode(encoding) |
|
756 |
||
|
3224.5.4
by Andrew Bennetts
Fix test suite, mainly weeding out uses of bzrlib.user_encoding. |
757 |
old_encoding = osutils._cached_user_encoding |
|
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
758 |
# This test requires that 'run_bzr' uses the current
|
759 |
# bzrlib, because we override user_encoding, and expect
|
|
760 |
# it to be used
|
|
761 |
try: |
|
|
3224.5.4
by Andrew Bennetts
Fix test suite, mainly weeding out uses of bzrlib.user_encoding. |
762 |
osutils._cached_user_encoding = 'ascii' |
|
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
763 |
# We should be able to handle any encoding
|
764 |
out, err = bzr('log', encoding=encoding) |
|
765 |
if not fail: |
|
766 |
# Make sure we wrote mu as we expected it to exist
|
|
767 |
self.assertNotEqual(-1, out.find(encoded_msg)) |
|
768 |
out_unicode = out.decode(encoding) |
|
769 |
self.assertNotEqual(-1, out_unicode.find(self._message)) |
|
770 |
else: |
|
771 |
self.assertNotEqual(-1, out.find('Message with ?')) |
|
772 |
finally: |
|
|
3224.5.4
by Andrew Bennetts
Fix test suite, mainly weeding out uses of bzrlib.user_encoding. |
773 |
osutils._cached_user_encoding = old_encoding |
|
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
774 |
|
775 |
def test_log_handles_encoding(self): |
|
776 |
self.create_branch() |
|
777 |
||
778 |
for encoding in self.good_encodings: |
|
779 |
self.try_encoding(encoding) |
|
780 |
||
781 |
def test_log_handles_bad_encoding(self): |
|
782 |
self.create_branch() |
|
783 |
||
784 |
for encoding in self.bad_encodings: |
|
785 |
self.try_encoding(encoding, fail=True) |
|
786 |
||
787 |
def test_stdout_encoding(self): |
|
788 |
bzr = self.run_bzr |
|
|
3224.5.4
by Andrew Bennetts
Fix test suite, mainly weeding out uses of bzrlib.user_encoding. |
789 |
osutils._cached_user_encoding = "cp1251" |
|
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
790 |
|
791 |
bzr('init') |
|
792 |
self.build_tree(['a']) |
|
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
793 |
bzr('add a') |
794 |
bzr(['commit', '-m', u'\u0422\u0435\u0441\u0442']) |
|
|
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
795 |
stdout, stderr = self.run_bzr('log', encoding='cp866') |
796 |
||
797 |
message = stdout.splitlines()[-1] |
|
798 |
||
799 |
# explanation of the check:
|
|
800 |
# u'\u0422\u0435\u0441\u0442' is word 'Test' in russian
|
|
801 |
# in cp866 encoding this is string '\x92\xa5\xe1\xe2'
|
|
802 |
# in cp1251 encoding this is string '\xd2\xe5\xf1\xf2'
|
|
803 |
# This test should check that output of log command
|
|
804 |
# encoded to sys.stdout.encoding
|
|
805 |
test_in_cp866 = '\x92\xa5\xe1\xe2' |
|
806 |
test_in_cp1251 = '\xd2\xe5\xf1\xf2' |
|
807 |
# Make sure the log string is encoded in cp866
|
|
808 |
self.assertEquals(test_in_cp866, message[2:]) |
|
809 |
# Make sure the cp1251 string is not found anywhere
|
|
810 |
self.assertEquals(-1, stdout.find(test_in_cp1251)) |
|
811 |
||
|
1551.10.18
by Aaron Bentley
Log works in local treeless branches (#84247) |
812 |
|
|
4325.4.3
by Vincent Ladeuil
More cleanups. |
813 |
class TestLogFile(tests.TestCaseWithTransport): |
|
1551.10.18
by Aaron Bentley
Log works in local treeless branches (#84247) |
814 |
|
815 |
def test_log_local_branch_file(self): |
|
816 |
"""We should be able to log files in local treeless branches""" |
|
817 |
tree = self.make_branch_and_tree('tree') |
|
818 |
self.build_tree(['tree/file']) |
|
819 |
tree.add('file') |
|
820 |
tree.commit('revision 1') |
|
821 |
tree.bzrdir.destroy_workingtree() |
|
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
822 |
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. |
823 |
|
|
3943.6.1
by Ian Clatworthy
find file using the end revision |
824 |
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 |
825 |
# 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. |
826 |
tree = self.make_branch_and_tree('parent') |
827 |
self.build_tree(['parent/file1', 'parent/file2', 'parent/file3']) |
|
828 |
tree.add('file1') |
|
829 |
tree.commit('add file1') |
|
830 |
tree.add('file2') |
|
831 |
tree.commit('add file2') |
|
832 |
tree.add('file3') |
|
833 |
tree.commit('add file3') |
|
|
2664.14.1
by Daniel Watkins
Fixed tests.blackbox.test_log to use internals where appropriate. |
834 |
child_tree = tree.bzrdir.sprout('child').open_workingtree() |
835 |
self.build_tree_contents([('child/file2', 'hello')]) |
|
836 |
child_tree.commit(message='branch 1') |
|
837 |
tree.merge_from_branch(child_tree.branch) |
|
838 |
tree.commit(message='merge child branch') |
|
|
3943.6.1
by Ian Clatworthy
find file using the end revision |
839 |
if complex: |
|
3943.6.3
by Ian Clatworthy
search the start tree if the end tree doesn't have a file |
840 |
tree.remove('file2') |
841 |
tree.commit('remove file2') |
|
842 |
tree.rename_one('file3', 'file4') |
|
843 |
tree.commit('file3 is now called file4') |
|
|
3943.6.1
by Ian Clatworthy
find file using the end revision |
844 |
tree.remove('file1') |
|
3943.6.3
by Ian Clatworthy
search the start tree if the end tree doesn't have a file |
845 |
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. |
846 |
os.chdir('parent') |
|
3940.1.2
by Ian Clatworthy
add test |
847 |
|
848 |
def test_log_file(self): |
|
849 |
"""The log for a particular file should only list revs for that file""" |
|
850 |
self.prepare_tree() |
|
|
4206.1.1
by Ian Clatworthy
log mainline by default |
851 |
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. |
852 |
self.assertContainsRe(log, 'revno: 1\n') |
853 |
self.assertNotContainsRe(log, 'revno: 2\n') |
|
854 |
self.assertNotContainsRe(log, 'revno: 3\n') |
|
855 |
self.assertNotContainsRe(log, 'revno: 3.1.1\n') |
|
|
4208.2.1
by Ian Clatworthy
merge indicators in log --long |
856 |
self.assertNotContainsRe(log, 'revno: 4 ') |
|
4206.1.1
by Ian Clatworthy
log mainline by default |
857 |
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. |
858 |
self.assertNotContainsRe(log, 'revno: 1\n') |
859 |
self.assertContainsRe(log, 'revno: 2\n') |
|
860 |
self.assertNotContainsRe(log, 'revno: 3\n') |
|
861 |
self.assertContainsRe(log, 'revno: 3.1.1\n') |
|
|
4208.2.1
by Ian Clatworthy
merge indicators in log --long |
862 |
self.assertContainsRe(log, 'revno: 4 ') |
|
4206.1.1
by Ian Clatworthy
log mainline by default |
863 |
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. |
864 |
self.assertNotContainsRe(log, 'revno: 1\n') |
865 |
self.assertNotContainsRe(log, 'revno: 2\n') |
|
866 |
self.assertContainsRe(log, 'revno: 3\n') |
|
867 |
self.assertNotContainsRe(log, 'revno: 3.1.1\n') |
|
|
4208.2.1
by Ian Clatworthy
merge indicators in log --long |
868 |
self.assertNotContainsRe(log, 'revno: 4 ') |
|
4206.1.1
by Ian Clatworthy
log mainline by default |
869 |
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. |
870 |
self.assertNotContainsRe(log, 'revno: 1\n') |
871 |
self.assertNotContainsRe(log, 'revno: 2\n') |
|
872 |
self.assertNotContainsRe(log, 'revno: 3\n') |
|
873 |
self.assertContainsRe(log, 'revno: 3.1.1\n') |
|
|
4208.2.1
by Ian Clatworthy
merge indicators in log --long |
874 |
self.assertNotContainsRe(log, 'revno: 4 ') |
|
4206.1.1
by Ian Clatworthy
log mainline by default |
875 |
log = self.run_bzr('log -n0 -r4 file2')[0] |
876 |
self.assertNotContainsRe(log, 'revno: 1\n') |
|
877 |
self.assertNotContainsRe(log, 'revno: 2\n') |
|
878 |
self.assertNotContainsRe(log, 'revno: 3\n') |
|
879 |
self.assertContainsRe(log, 'revno: 3.1.1\n') |
|
|
4214.1.1
by Ian Clatworthy
log mainline only by default (Ian Clatworthy) |
880 |
self.assertContainsRe(log, 'revno: 4 ') |
|
4206.1.1
by Ian Clatworthy
log mainline by default |
881 |
log = self.run_bzr('log -n0 -r3.. file2')[0] |
882 |
self.assertNotContainsRe(log, 'revno: 1\n') |
|
883 |
self.assertNotContainsRe(log, 'revno: 2\n') |
|
884 |
self.assertNotContainsRe(log, 'revno: 3\n') |
|
885 |
self.assertContainsRe(log, 'revno: 3.1.1\n') |
|
|
4214.1.1
by Ian Clatworthy
log mainline only by default (Ian Clatworthy) |
886 |
self.assertContainsRe(log, 'revno: 4 ') |
|
4206.1.1
by Ian Clatworthy
log mainline by default |
887 |
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. |
888 |
self.assertNotContainsRe(log, 'revno: 1\n') |
889 |
self.assertContainsRe(log, 'revno: 2\n') |
|
890 |
self.assertNotContainsRe(log, 'revno: 3\n') |
|
891 |
self.assertNotContainsRe(log, 'revno: 3.1.1\n') |
|
|
4208.2.1
by Ian Clatworthy
merge indicators in log --long |
892 |
self.assertNotContainsRe(log, 'revno: 4 ') |
|
3940.1.2
by Ian Clatworthy
add test |
893 |
|
|
3943.6.4
by Ian Clatworthy
review feedback from vila |
894 |
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 |
895 |
# Check logging a deleted file gives an error if the
|
896 |
# file isn't found at the end or start of the revision range
|
|
|
3943.6.4
by Ian Clatworthy
review feedback from vila |
897 |
self.prepare_tree(complex=True) |
|
3943.6.3
by Ian Clatworthy
search the start tree if the end tree doesn't have a file |
898 |
err_msg = "Path unknown at end or start of revision range: file2" |
899 |
err = self.run_bzr('log file2', retcode=3)[1] |
|
|
3943.6.1
by Ian Clatworthy
find file using the end revision |
900 |
self.assertContainsRe(err, err_msg) |
901 |
||
|
3943.6.4
by Ian Clatworthy
review feedback from vila |
902 |
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 |
903 |
# Check logging a deleted file is ok if the file existed
|
904 |
# at the end the revision range
|
|
|
3943.6.4
by Ian Clatworthy
review feedback from vila |
905 |
self.prepare_tree(complex=True) |
|
4206.1.1
by Ian Clatworthy
log mainline by default |
906 |
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 |
907 |
self.assertEquals('', err) |
908 |
self.assertNotContainsRe(log, 'revno: 1\n') |
|
909 |
self.assertContainsRe(log, 'revno: 2\n') |
|
910 |
self.assertNotContainsRe(log, 'revno: 3\n') |
|
911 |
self.assertContainsRe(log, 'revno: 3.1.1\n') |
|
|
4208.2.1
by Ian Clatworthy
merge indicators in log --long |
912 |
self.assertContainsRe(log, 'revno: 4 ') |
|
3943.6.3
by Ian Clatworthy
search the start tree if the end tree doesn't have a file |
913 |
|
|
3943.6.4
by Ian Clatworthy
review feedback from vila |
914 |
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 |
915 |
# Check logging a deleted file is ok if the file existed
|
916 |
# at the start of the revision range
|
|
|
3943.6.4
by Ian Clatworthy
review feedback from vila |
917 |
self.prepare_tree(complex=True) |
|
3943.6.3
by Ian Clatworthy
search the start tree if the end tree doesn't have a file |
918 |
log, err = self.run_bzr('log file1') |
919 |
self.assertEquals('', err) |
|
|
3943.6.1
by Ian Clatworthy
find file using the end revision |
920 |
self.assertContainsRe(log, 'revno: 1\n') |
921 |
self.assertNotContainsRe(log, 'revno: 2\n') |
|
922 |
self.assertNotContainsRe(log, 'revno: 3\n') |
|
923 |
self.assertNotContainsRe(log, 'revno: 3.1.1\n') |
|
|
4208.2.1
by Ian Clatworthy
merge indicators in log --long |
924 |
self.assertNotContainsRe(log, 'revno: 4 ') |
|
3943.6.1
by Ian Clatworthy
find file using the end revision |
925 |
|
926 |
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 |
927 |
"""File matched against revision range, not current tree.""" |
|
3943.6.1
by Ian Clatworthy
find file using the end revision |
928 |
self.prepare_tree(complex=True) |
|
3943.6.3
by Ian Clatworthy
search the start tree if the end tree doesn't have a file |
929 |
|
|
3943.6.1
by Ian Clatworthy
find file using the end revision |
930 |
# 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 |
931 |
err_msg = "Path unknown at end or start of revision range: file3" |
|
3943.6.1
by Ian Clatworthy
find file using the end revision |
932 |
err = self.run_bzr('log file3', retcode=3)[1] |
933 |
self.assertContainsRe(err, err_msg) |
|
934 |
||
935 |
# 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 |
936 |
log, err = self.run_bzr('log -r..4 file3') |
937 |
self.assertEquals('', err) |
|
|
3943.6.1
by Ian Clatworthy
find file using the end revision |
938 |
self.assertNotContainsRe(log, 'revno: 1\n') |
939 |
self.assertNotContainsRe(log, 'revno: 2\n') |
|
940 |
self.assertContainsRe(log, 'revno: 3\n') |
|
941 |
self.assertNotContainsRe(log, 'revno: 3.1.1\n') |
|
|
4208.2.1
by Ian Clatworthy
merge indicators in log --long |
942 |
self.assertNotContainsRe(log, 'revno: 4 ') |
|
3943.6.1
by Ian Clatworthy
find file using the end revision |
943 |
|
|
3940.1.2
by Ian Clatworthy
add test |
944 |
def test_line_log_file(self): |
945 |
"""The line log for a file should only list relevant mainline revs""" |
|
946 |
# Note: this also implicitly covers the short logging case.
|
|
947 |
# We test using --line in preference to --short because matching
|
|
948 |
# revnos in the output of --line is more reliable.
|
|
949 |
self.prepare_tree() |
|
|
3940.1.5
by Ian Clatworthy
feedback from vila |
950 |
|
951 |
# full history of file1
|
|
|
3940.1.2
by Ian Clatworthy
add test |
952 |
log = self.run_bzr('log --line file1')[0] |
953 |
self.assertContainsRe(log, '^1:', re.MULTILINE) |
|
954 |
self.assertNotContainsRe(log, '^2:', re.MULTILINE) |
|
955 |
self.assertNotContainsRe(log, '^3:', re.MULTILINE) |
|
956 |
self.assertNotContainsRe(log, '^3.1.1:', re.MULTILINE) |
|
957 |
self.assertNotContainsRe(log, '^4:', re.MULTILINE) |
|
|
3940.1.5
by Ian Clatworthy
feedback from vila |
958 |
|
959 |
# full history of file2
|
|
|
3940.1.2
by Ian Clatworthy
add test |
960 |
log = self.run_bzr('log --line file2')[0] |
961 |
self.assertNotContainsRe(log, '^1:', re.MULTILINE) |
|
962 |
self.assertContainsRe(log, '^2:', re.MULTILINE) |
|
963 |
self.assertNotContainsRe(log, '^3:', re.MULTILINE) |
|
964 |
self.assertNotContainsRe(log, '^3.1.1:', re.MULTILINE) |
|
965 |
self.assertContainsRe(log, '^4:', re.MULTILINE) |
|
|
3940.1.5
by Ian Clatworthy
feedback from vila |
966 |
|
967 |
# full history of file3
|
|
|
3940.1.2
by Ian Clatworthy
add test |
968 |
log = self.run_bzr('log --line file3')[0] |
969 |
self.assertNotContainsRe(log, '^1:', re.MULTILINE) |
|
970 |
self.assertNotContainsRe(log, '^2:', re.MULTILINE) |
|
971 |
self.assertContainsRe(log, '^3:', re.MULTILINE) |
|
972 |
self.assertNotContainsRe(log, '^3.1.1:', re.MULTILINE) |
|
973 |
self.assertNotContainsRe(log, '^4:', re.MULTILINE) |
|
|
3940.1.5
by Ian Clatworthy
feedback from vila |
974 |
|
975 |
# file in a merge revision
|
|
|
3940.1.2
by Ian Clatworthy
add test |
976 |
log = self.run_bzr('log --line -r3.1.1 file2')[0] |
977 |
self.assertNotContainsRe(log, '^1:', re.MULTILINE) |
|
978 |
self.assertNotContainsRe(log, '^2:', re.MULTILINE) |
|
979 |
self.assertNotContainsRe(log, '^3:', re.MULTILINE) |
|
980 |
self.assertContainsRe(log, '^3.1.1:', re.MULTILINE) |
|
981 |
self.assertNotContainsRe(log, '^4:', re.MULTILINE) |
|
|
3940.1.5
by Ian Clatworthy
feedback from vila |
982 |
|
983 |
# file in a mainline revision
|
|
|
3940.1.2
by Ian Clatworthy
add test |
984 |
log = self.run_bzr('log --line -r4 file2')[0] |
985 |
self.assertNotContainsRe(log, '^1:', re.MULTILINE) |
|
986 |
self.assertNotContainsRe(log, '^2:', re.MULTILINE) |
|
987 |
self.assertNotContainsRe(log, '^3:', re.MULTILINE) |
|
988 |
self.assertNotContainsRe(log, '^3.1.1:', re.MULTILINE) |
|
989 |
self.assertContainsRe(log, '^4:', re.MULTILINE) |
|
|
3940.1.5
by Ian Clatworthy
feedback from vila |
990 |
|
991 |
# file since a revision
|
|
|
3940.1.2
by Ian Clatworthy
add test |
992 |
log = self.run_bzr('log --line -r3.. file2')[0] |
993 |
self.assertNotContainsRe(log, '^1:', re.MULTILINE) |
|
994 |
self.assertNotContainsRe(log, '^2:', re.MULTILINE) |
|
995 |
self.assertNotContainsRe(log, '^3:', re.MULTILINE) |
|
996 |
self.assertNotContainsRe(log, '^3.1.1:', re.MULTILINE) |
|
997 |
self.assertContainsRe(log, '^4:', re.MULTILINE) |
|
|
3940.1.5
by Ian Clatworthy
feedback from vila |
998 |
|
999 |
# file up to a revision
|
|
|
3940.1.2
by Ian Clatworthy
add test |
1000 |
log = self.run_bzr('log --line -r..3 file2')[0] |
1001 |
self.assertNotContainsRe(log, '^1:', re.MULTILINE) |
|
1002 |
self.assertContainsRe(log, '^2:', re.MULTILINE) |
|
1003 |
self.assertNotContainsRe(log, '^3:', re.MULTILINE) |
|
1004 |
self.assertNotContainsRe(log, '^3.1.1:', re.MULTILINE) |
|
1005 |
self.assertNotContainsRe(log, '^4:', re.MULTILINE) |
|
|
4202.2.1
by Ian Clatworthy
get directory logging working again |
1006 |
|
1007 |
||
|
4325.4.3
by Vincent Ladeuil
More cleanups. |
1008 |
class TestLogMultiple(tests.TestCaseWithTransport): |
|
4202.2.1
by Ian Clatworthy
get directory logging working again |
1009 |
|
1010 |
def prepare_tree(self): |
|
1011 |
tree = self.make_branch_and_tree('parent') |
|
1012 |
self.build_tree([ |
|
1013 |
'parent/file1', |
|
1014 |
'parent/file2', |
|
1015 |
'parent/dir1/', |
|
1016 |
'parent/dir1/file5', |
|
1017 |
'parent/dir1/dir2/', |
|
1018 |
'parent/dir1/dir2/file3', |
|
1019 |
'parent/file4']) |
|
1020 |
tree.add('file1') |
|
|
4202.2.2
by Ian Clatworthy
improve signal-to-noise ratio in tests |
1021 |
tree.commit('add file1') |
|
4202.2.1
by Ian Clatworthy
get directory logging working again |
1022 |
tree.add('file2') |
|
4202.2.2
by Ian Clatworthy
improve signal-to-noise ratio in tests |
1023 |
tree.commit('add file2') |
|
4202.2.1
by Ian Clatworthy
get directory logging working again |
1024 |
tree.add(['dir1', 'dir1/dir2', 'dir1/dir2/file3']) |
|
4202.2.2
by Ian Clatworthy
improve signal-to-noise ratio in tests |
1025 |
tree.commit('add file3') |
|
4202.2.1
by Ian Clatworthy
get directory logging working again |
1026 |
tree.add('file4') |
|
4202.2.2
by Ian Clatworthy
improve signal-to-noise ratio in tests |
1027 |
tree.commit('add file4') |
|
4202.2.1
by Ian Clatworthy
get directory logging working again |
1028 |
tree.add('dir1/file5') |
|
4202.2.2
by Ian Clatworthy
improve signal-to-noise ratio in tests |
1029 |
tree.commit('add file5') |
|
4202.2.1
by Ian Clatworthy
get directory logging working again |
1030 |
child_tree = tree.bzrdir.sprout('child').open_workingtree() |
1031 |
self.build_tree_contents([('child/file2', 'hello')]) |
|
|
4202.2.2
by Ian Clatworthy
improve signal-to-noise ratio in tests |
1032 |
child_tree.commit(message='branch 1') |
|
4202.2.1
by Ian Clatworthy
get directory logging working again |
1033 |
tree.merge_from_branch(child_tree.branch) |
|
4202.2.2
by Ian Clatworthy
improve signal-to-noise ratio in tests |
1034 |
tree.commit(message='merge child branch') |
|
4202.2.1
by Ian Clatworthy
get directory logging working again |
1035 |
os.chdir('parent') |
1036 |
||
|
4202.2.2
by Ian Clatworthy
improve signal-to-noise ratio in tests |
1037 |
def assertRevnos(self, paths_str, expected_revnos): |
1038 |
# confirm the revision numbers in log --line output are those expected
|
|
1039 |
out, err = self.run_bzr('log --line -n0 %s' % (paths_str,)) |
|
1040 |
self.assertEqual('', err) |
|
1041 |
revnos = [s.split(':', 1)[0].lstrip() for s in out.splitlines()] |
|
|
4202.2.5
by Ian Clatworthy
apply review tweaks & update help |
1042 |
self.assertEqual(expected_revnos, revnos) |
|
4202.2.2
by Ian Clatworthy
improve signal-to-noise ratio in tests |
1043 |
|
|
4202.2.1
by Ian Clatworthy
get directory logging working again |
1044 |
def test_log_files(self): |
1045 |
"""The log for multiple file should only list revs for those files""" |
|
1046 |
self.prepare_tree() |
|
|
4202.2.2
by Ian Clatworthy
improve signal-to-noise ratio in tests |
1047 |
self.assertRevnos('file1 file2 dir1/dir2/file3', |
1048 |
['6', '5.1.1', '3', '2', '1']) |
|
|
4202.2.1
by Ian Clatworthy
get directory logging working again |
1049 |
|
1050 |
def test_log_directory(self): |
|
1051 |
"""The log for a directory should show all nested files.""" |
|
1052 |
self.prepare_tree() |
|
|
4202.2.2
by Ian Clatworthy
improve signal-to-noise ratio in tests |
1053 |
self.assertRevnos('dir1', ['5', '3']) |
|
4202.2.1
by Ian Clatworthy
get directory logging working again |
1054 |
|
1055 |
def test_log_nested_directory(self): |
|
1056 |
"""The log for a directory should show all nested files.""" |
|
1057 |
self.prepare_tree() |
|
|
4202.2.2
by Ian Clatworthy
improve signal-to-noise ratio in tests |
1058 |
self.assertRevnos('dir1/dir2', ['3']) |
|
4202.2.1
by Ian Clatworthy
get directory logging working again |
1059 |
|
1060 |
def test_log_in_nested_directory(self): |
|
1061 |
"""The log for a directory should show all nested files.""" |
|
1062 |
self.prepare_tree() |
|
1063 |
os.chdir("dir1") |
|
|
4202.2.2
by Ian Clatworthy
improve signal-to-noise ratio in tests |
1064 |
self.assertRevnos('.', ['5', '3']) |
|
4202.2.1
by Ian Clatworthy
get directory logging working again |
1065 |
|
1066 |
def test_log_files_and_directories(self): |
|
1067 |
"""Logging files and directories together should be fine.""" |
|
1068 |
self.prepare_tree() |
|
|
4202.2.2
by Ian Clatworthy
improve signal-to-noise ratio in tests |
1069 |
self.assertRevnos('file4 dir1/dir2', ['4', '3']) |
|
4202.2.1
by Ian Clatworthy
get directory logging working again |
1070 |
|
1071 |
def test_log_files_and_dirs_in_nested_directory(self): |
|
1072 |
"""The log for a directory should show all nested files.""" |
|
1073 |
self.prepare_tree() |
|
1074 |
os.chdir("dir1") |
|
|
4202.2.2
by Ian Clatworthy
improve signal-to-noise ratio in tests |
1075 |
self.assertRevnos('dir2 file5', ['5', '3']) |