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