bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
1551.10.18
by Aaron Bentley
Log works in local treeless branches (#84247) |
1 |
# Copyright (C) 2005, 2006, 2007 Canonical Ltd
|
|
1540.2.6
by Robey Pointer
make 'log' and 'status' treat '-r N..' as implicitly '-r N..-1' |
2 |
# -*- coding: utf-8 -*-
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
3 |
#
|
|
1540.2.6
by Robey Pointer
make 'log' and 'status' treat '-r N..' as implicitly '-r N..-1' |
4 |
# This program is free software; you can redistribute it and/or modify
|
5 |
# it under the terms of the GNU General Public License as published by
|
|
6 |
# the Free Software Foundation; either version 2 of the License, or
|
|
7 |
# (at your option) any later version.
|
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
8 |
#
|
|
1540.2.6
by Robey Pointer
make 'log' and 'status' treat '-r N..' as implicitly '-r N..-1' |
9 |
# This program is distributed in the hope that it will be useful,
|
10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12 |
# GNU General Public License for more details.
|
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
13 |
#
|
|
1540.2.6
by Robey Pointer
make 'log' and 'status' treat '-r N..' as implicitly '-r N..-1' |
14 |
# You should have received a copy of the GNU General Public License
|
15 |
# along with this program; if not, write to the Free Software
|
|
16 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
17 |
||
18 |
||
|
1624.1.3
by Robert Collins
Convert log to use the new tsort.merge_sort routine. |
19 |
"""Black-box tests for bzr log."""
|
|
1540.2.6
by Robey Pointer
make 'log' and 'status' treat '-r N..' as implicitly '-r N..-1' |
20 |
|
|
1624.1.3
by Robert Collins
Convert log to use the new tsort.merge_sort routine. |
21 |
import os |
|
1540.2.6
by Robey Pointer
make 'log' and 'status' treat '-r N..' as implicitly '-r N..-1' |
22 |
|
|
3224.5.4
by Andrew Bennetts
Fix test suite, mainly weeding out uses of bzrlib.user_encoding. |
23 |
from bzrlib import osutils |
|
1540.2.6
by Robey Pointer
make 'log' and 'status' treat '-r N..' as implicitly '-r N..-1' |
24 |
from bzrlib.tests.blackbox import ExternalBase |
|
1551.10.18
by Aaron Bentley
Log works in local treeless branches (#84247) |
25 |
from bzrlib.tests import TestCaseInTempDir, TestCaseWithTransport |
|
2978.6.1
by Kent Gibson
Use normalize_log to more accurately test blackbox log output. |
26 |
from bzrlib.tests.test_log import ( |
27 |
normalize_log, |
|
28 |
)
|
|
|
3144.7.9
by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors |
29 |
from bzrlib.tests import test_log |
30 |
||
31 |
||
|
3842.2.5
by Vincent Ladeuil
Better fix for bug #300055. |
32 |
class TestCaseWithoutPropsHandler(ExternalBase, |
33 |
test_log.TestCaseWithoutPropsHandler): |
|
|
3144.7.9
by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors |
34 |
pass
|
|
1540.2.6
by Robey Pointer
make 'log' and 'status' treat '-r N..' as implicitly '-r N..-1' |
35 |
|
36 |
||
37 |
class TestLog(ExternalBase): |
|
38 |
||
|
2664.14.1
by Daniel Watkins
Fixed tests.blackbox.test_log to use internals where appropriate. |
39 |
def _prepare(self, path='.', format=None): |
|
2809.1.2
by Daniel Watkins
Removed unnecessary check as per abentley's on-list comments. |
40 |
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. |
41 |
self.build_tree( |
42 |
[path + '/hello.txt', path + '/goodbye.txt', path + '/meep.txt']) |
|
43 |
tree.add('hello.txt') |
|
44 |
tree.commit(message='message1') |
|
45 |
tree.add('goodbye.txt') |
|
46 |
tree.commit(message='message2') |
|
47 |
tree.add('meep.txt') |
|
48 |
tree.commit(message='message3') |
|
49 |
self.full_log = self.run_bzr(["log", path])[0] |
|
50 |
return tree |
|
|
1553.4.2
by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure |
51 |
|
52 |
def test_log_null_end_revspec(self): |
|
53 |
self._prepare() |
|
54 |
self.assertTrue('revno: 1\n' in self.full_log) |
|
55 |
self.assertTrue('revno: 2\n' in self.full_log) |
|
56 |
self.assertTrue('revno: 3\n' in self.full_log) |
|
57 |
self.assertTrue('message:\n message1\n' in self.full_log) |
|
58 |
self.assertTrue('message:\n message2\n' in self.full_log) |
|
59 |
self.assertTrue('message:\n message3\n' in self.full_log) |
|
60 |
||
|
2530.3.1
by Martin Pool
Cleanup old variations on run_bzr in the test suite |
61 |
log = self.run_bzr("log -r 1..")[0] |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
62 |
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 |
63 |
|
64 |
def test_log_null_begin_revspec(self): |
|
65 |
self._prepare() |
|
|
2530.3.1
by Martin Pool
Cleanup old variations on run_bzr in the test suite |
66 |
log = self.run_bzr("log -r ..3")[0] |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
67 |
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 |
68 |
|
69 |
def test_log_null_both_revspecs(self): |
|
70 |
self._prepare() |
|
|
2530.3.1
by Martin Pool
Cleanup old variations on run_bzr in the test suite |
71 |
log = self.run_bzr("log -r ..")[0] |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
72 |
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 |
73 |
|
|
2978.4.1
by Kent Gibson
Logging revision 0 returns error. |
74 |
def test_log_zero_revspec(self): |
75 |
self._prepare() |
|
76 |
self.run_bzr_error('bzr: ERROR: Logging revision 0 is invalid.', |
|
77 |
['log', '-r0']) |
|
78 |
||
79 |
def test_log_zero_begin_revspec(self): |
|
80 |
self._prepare() |
|
81 |
self.run_bzr_error('bzr: ERROR: Logging revision 0 is invalid.', |
|
82 |
['log', '-r0..2']) |
|
83 |
||
84 |
def test_log_zero_end_revspec(self): |
|
85 |
self._prepare() |
|
86 |
self.run_bzr_error('bzr: ERROR: Logging revision 0 is invalid.', |
|
87 |
['log', '-r-2..0']) |
|
88 |
||
|
3144.1.1
by Lukáš Lalinský
Fixed error reporting of unsupported timezone format. |
89 |
def test_log_unsupported_timezone(self): |
90 |
self._prepare() |
|
91 |
self.run_bzr_error('bzr: ERROR: Unsupported timezone format "foo", ' |
|
92 |
'options are "utc", "original", "local".', |
|
93 |
['log', '--timezone', 'foo']) |
|
94 |
||
|
1553.4.2
by Michael Ellerman
Make bzr log -r .. work, fixes bug #4609. Add a bunch of tests to make sure |
95 |
def test_log_negative_begin_revspec_full_log(self): |
96 |
self._prepare() |
|
|
2530.3.1
by Martin Pool
Cleanup old variations on run_bzr in the test suite |
97 |
log = self.run_bzr("log -r -3..")[0] |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
98 |
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 |
99 |
|
100 |
def test_log_negative_both_revspec_full_log(self): |
|
101 |
self._prepare() |
|
|
2530.3.1
by Martin Pool
Cleanup old variations on run_bzr in the test suite |
102 |
log = self.run_bzr("log -r -3..-1")[0] |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
103 |
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 |
104 |
|
105 |
def test_log_negative_both_revspec_partial(self): |
|
106 |
self._prepare() |
|
|
2530.3.1
by Martin Pool
Cleanup old variations on run_bzr in the test suite |
107 |
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 |
108 |
self.assertTrue('revno: 1\n' in log) |
109 |
self.assertTrue('revno: 2\n' in log) |
|
110 |
self.assertTrue('revno: 3\n' not in log) |
|
111 |
||
112 |
def test_log_negative_begin_revspec(self): |
|
113 |
self._prepare() |
|
|
2530.3.1
by Martin Pool
Cleanup old variations on run_bzr in the test suite |
114 |
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 |
115 |
self.assertTrue('revno: 1\n' not in log) |
116 |
self.assertTrue('revno: 2\n' in log) |
|
117 |
self.assertTrue('revno: 3\n' in log) |
|
118 |
||
|
2978.4.1
by Kent Gibson
Logging revision 0 returns error. |
119 |
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 |
120 |
self._prepare() |
|
2530.3.1
by Martin Pool
Cleanup old variations on run_bzr in the test suite |
121 |
log = self.run_bzr("log -r 1..3")[0] |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
122 |
self.assertEqualDiff(self.full_log, log) |
|
1624.1.3
by Robert Collins
Convert log to use the new tsort.merge_sort routine. |
123 |
|
|
2466.12.1
by Kent Gibson
Fix ``bzr log -r`` to support selecting merge revisions. |
124 |
def test_log_reversed_revspecs(self): |
125 |
self._prepare() |
|
126 |
self.run_bzr_error(('bzr: ERROR: Start revision must be older than ' |
|
127 |
'the end revision.\n',), |
|
|
2581.1.6
by Martin Pool
fix up more run_bzr callers |
128 |
['log', '-r3..1']) |
|
2466.12.1
by Kent Gibson
Fix ``bzr log -r`` to support selecting merge revisions. |
129 |
|
|
1907.4.2
by Matthieu Moy
Make log work nicely with revno:N:path too. |
130 |
def test_log_revno_n_path(self): |
|
2664.14.1
by Daniel Watkins
Fixed tests.blackbox.test_log to use internals where appropriate. |
131 |
self._prepare(path='branch1') |
132 |
self._prepare(path='branch2') |
|
|
2530.3.1
by Martin Pool
Cleanup old variations on run_bzr in the test suite |
133 |
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. |
134 |
retcode=3)[0] |
|
2530.3.1
by Martin Pool
Cleanup old variations on run_bzr in the test suite |
135 |
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 |
136 |
self.assertEqualDiff(self.full_log, log) |
|
2530.3.1
by Martin Pool
Cleanup old variations on run_bzr in the test suite |
137 |
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. |
138 |
self.assertTrue('revno: 1\n' in log) |
139 |
self.assertTrue('revno: 2\n' not in log) |
|
140 |
self.assertTrue('branch nick: branch2\n' in log) |
|
141 |
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. |
142 |
|
|
3878.3.3
by Marius Kruger
Add tests for log -r with non-exising revno's |
143 |
def test_log_nonexistent_revno(self): |
144 |
self._prepare() |
|
145 |
(out, err) = self.run_bzr_error(args="log -r 1234", |
|
146 |
error_regexes=["bzr: ERROR: Requested revision: '1234' " |
|
147 |
"does not exist in branch:"]) |
|
148 |
||
149 |
def test_log_nonexistent_dotted_revno(self): |
|
150 |
self._prepare() |
|
151 |
(out, err) = self.run_bzr_error(args="log -r 123.123", |
|
152 |
error_regexes=["bzr: ERROR: Requested revision: '123.123' " |
|
153 |
"does not exist in branch:"]) |
|
154 |
||
|
3734.1.1
by Vincent Ladeuil
Fix bug #248427 by adding a --change option to log. |
155 |
def test_log_change_revno(self): |
156 |
self._prepare() |
|
157 |
expected_log = self.run_bzr("log -r 1")[0] |
|
158 |
log = self.run_bzr("log -c 1")[0] |
|
159 |
self.assertEqualDiff(expected_log, log) |
|
160 |
||
|
3878.3.2
by Marius Kruger
Add tests for log -c with non-exising revno's |
161 |
def test_log_change_nonexistent_revno(self): |
162 |
self._prepare() |
|
163 |
(out, err) = self.run_bzr_error(args="log -c 1234", |
|
164 |
error_regexes=["bzr: ERROR: Requested revision: '1234' " |
|
165 |
"does not exist in branch:"]) |
|
166 |
||
167 |
def test_log_change_nonexistent_dotted_revno(self): |
|
168 |
self._prepare() |
|
169 |
(out, err) = self.run_bzr_error(args="log -c 123.123", |
|
170 |
error_regexes=["bzr: ERROR: Requested revision: '123.123' " |
|
171 |
"does not exist in branch:"]) |
|
172 |
||
|
3734.1.1
by Vincent Ladeuil
Fix bug #248427 by adding a --change option to log. |
173 |
def test_log_change_single_revno(self): |
174 |
self._prepare() |
|
175 |
self.run_bzr_error('bzr: ERROR: Option --change does not' |
|
176 |
' accept revision ranges', |
|
177 |
['log', '--change', '2..3']) |
|
178 |
||
179 |
def test_log_change_incompatible_with_revision(self): |
|
180 |
self._prepare() |
|
181 |
self.run_bzr_error('bzr: ERROR: --revision and --change' |
|
182 |
' are mutually exclusive', |
|
183 |
['log', '--change', '2', '--revision', '3']) |
|
184 |
||
|
2100.1.1
by wang
Running ``bzr log`` on nonexistent file gives an error instead of the |
185 |
def test_log_nonexistent_file(self): |
186 |
# files that don't exist in either the basis tree or working tree
|
|
187 |
# should give an error
|
|
188 |
wt = self.make_branch_and_tree('.') |
|
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
189 |
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 |
190 |
self.assertContainsRe( |
191 |
err, 'Path does not have any revision history: does-not-exist') |
|
|
2388.1.11
by Alexander Belchenko
changes after John's review |
192 |
|
|
2388.1.3
by Erik Bagfors
tests for tags in log output |
193 |
def test_log_with_tags(self): |
|
2664.14.1
by Daniel Watkins
Fixed tests.blackbox.test_log to use internals where appropriate. |
194 |
tree = self._prepare(format='dirstate-tags') |
195 |
branch = tree.branch |
|
196 |
branch.tags.set_tag('tag1', branch.get_rev_id(1)) |
|
197 |
branch.tags.set_tag('tag1.1', branch.get_rev_id(1)) |
|
|
3842.2.5
by Vincent Ladeuil
Better fix for bug #300055. |
198 |
branch.tags.set_tag('tag3', branch.last_revision()) |
199 |
||
|
2530.3.1
by Martin Pool
Cleanup old variations on run_bzr in the test suite |
200 |
log = self.run_bzr("log -r-1")[0] |
|
2388.1.3
by Erik Bagfors
tests for tags in log output |
201 |
self.assertTrue('tags: tag3' in log) |
202 |
||
|
2530.3.1
by Martin Pool
Cleanup old variations on run_bzr in the test suite |
203 |
log = self.run_bzr("log -r1")[0] |
|
2388.1.3
by Erik Bagfors
tests for tags in log output |
204 |
# I guess that we can't know the order of tags in the output
|
205 |
# since dicts are unordered, need to check both possibilities
|
|
|
2388.1.11
by Alexander Belchenko
changes after John's review |
206 |
self.assertContainsRe(log, r'tags: (tag1, tag1\.1|tag1\.1, tag1)') |
207 |
||
|
2388.1.9
by Erik Bagfors
test for merges with tags in log |
208 |
def test_merged_log_with_tags(self): |
|
2664.14.1
by Daniel Watkins
Fixed tests.blackbox.test_log to use internals where appropriate. |
209 |
branch1_tree = self._prepare(path='branch1', format='dirstate-tags') |
210 |
branch1 = branch1_tree.branch |
|
211 |
branch2_tree = branch1_tree.bzrdir.sprout('branch2').open_workingtree() |
|
212 |
branch1_tree.commit(message='foobar', allow_pointless=True) |
|
213 |
branch1.tags.set_tag('tag1', branch1.last_revision()) |
|
214 |
os.chdir('branch2') |
|
215 |
self.run_bzr('merge ../branch1') # tags don't propagate otherwise |
|
216 |
branch2_tree.commit(message='merge branch 1') |
|
|
2530.3.1
by Martin Pool
Cleanup old variations on run_bzr in the test suite |
217 |
log = self.run_bzr("log -r-1")[0] |
|
2388.1.11
by Alexander Belchenko
changes after John's review |
218 |
self.assertContainsRe(log, r' tags: tag1') |
|
2578.2.1
by Andrew Bennetts
Merge Kent Gibson's fix for bug #4663, resolving conflicts. |
219 |
log = self.run_bzr("log -r3.1.1")[0] |
|
2466.12.2
by Kent Gibson
shift log output with only merge revisions to the left margin |
220 |
self.assertContainsRe(log, r'tags: tag1') |
|
2388.1.3
by Erik Bagfors
tests for tags in log output |
221 |
|
|
2466.9.1
by Kent Gibson
add bzr log --limit |
222 |
def test_log_limit(self): |
|
3660.1.1
by Robert Collins
Fix log --limit (broken by log filtering patch). |
223 |
tree = self.make_branch_and_tree('.') |
224 |
# We want more commits than our batch size starts at
|
|
225 |
for pos in range(10): |
|
226 |
tree.commit("%s" % pos) |
|
|
2530.3.1
by Martin Pool
Cleanup old variations on run_bzr in the test suite |
227 |
log = self.run_bzr("log --limit 2")[0] |
|
3108.1.3
by Matt Nordhoff
Use assertContainsRe/assertNotContainsRe in tests. |
228 |
self.assertNotContainsRe(log, r'revno: 1\n') |
|
3660.1.1
by Robert Collins
Fix log --limit (broken by log filtering patch). |
229 |
self.assertNotContainsRe(log, r'revno: 2\n') |
230 |
self.assertNotContainsRe(log, r'revno: 3\n') |
|
231 |
self.assertNotContainsRe(log, r'revno: 4\n') |
|
232 |
self.assertNotContainsRe(log, r'revno: 5\n') |
|
233 |
self.assertNotContainsRe(log, r'revno: 6\n') |
|
234 |
self.assertNotContainsRe(log, r'revno: 7\n') |
|
235 |
self.assertNotContainsRe(log, r'revno: 8\n') |
|
236 |
self.assertContainsRe(log, r'revno: 9\n') |
|
237 |
self.assertContainsRe(log, r'revno: 10\n') |
|
|
2466.9.1
by Kent Gibson
add bzr log --limit |
238 |
|
|
3108.1.2
by Matt Nordhoff
Simple copied unit test. |
239 |
def test_log_limit_short(self): |
240 |
self._prepare() |
|
241 |
log = self.run_bzr("log -l 2")[0] |
|
|
3108.1.3
by Matt Nordhoff
Use assertContainsRe/assertNotContainsRe in tests. |
242 |
self.assertNotContainsRe(log, r'revno: 1\n') |
243 |
self.assertContainsRe(log, r'revno: 2\n') |
|
244 |
self.assertContainsRe(log, r'revno: 3\n') |
|
|
3144.7.9
by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors |
245 |
|
|
3874.1.8
by Vincent Ladeuil
Fixed as ber Robert's review. |
246 |
|
247 |
class TestLogVerbose(TestCaseWithTransport): |
|
248 |
||
249 |
def setUp(self): |
|
250 |
super(TestLogVerbose, self).setUp() |
|
251 |
tree = self.make_branch_and_tree('.') |
|
252 |
self.build_tree(['hello.txt']) |
|
253 |
tree.add('hello.txt') |
|
254 |
tree.commit(message='message1') |
|
255 |
||
256 |
def assertUseShortDeltaFormat(self, cmd): |
|
257 |
log = self.run_bzr(cmd)[0] |
|
258 |
# Check that we use the short status format
|
|
|
3874.1.4
by Vincent Ladeuil
Fixed as per Aarons' comment. |
259 |
self.assertContainsRe(log, '(?m)^A hello.txt$') |
260 |
self.assertNotContainsRe(log, '(?m)^added:$') |
|
261 |
||
|
3874.1.8
by Vincent Ladeuil
Fixed as ber Robert's review. |
262 |
def assertUseLongDeltaFormat(self, cmd): |
263 |
log = self.run_bzr(cmd)[0] |
|
264 |
# Check that we use the long status format
|
|
265 |
self.assertNotContainsRe(log, '(?m)^A hello.txt$') |
|
266 |
self.assertContainsRe(log, '(?m)^added:$') |
|
267 |
||
268 |
def test_log_short_verbose(self): |
|
269 |
self.assertUseShortDeltaFormat(['log', '--short', '-v']) |
|
270 |
||
|
3874.1.4
by Vincent Ladeuil
Fixed as per Aarons' comment. |
271 |
def test_log_short_verbose_verbose(self): |
|
3874.1.8
by Vincent Ladeuil
Fixed as ber Robert's review. |
272 |
self.assertUseLongDeltaFormat(['log', '--short', '-vv']) |
|
3874.1.4
by Vincent Ladeuil
Fixed as per Aarons' comment. |
273 |
|
274 |
def test_log_long_verbose(self): |
|
|
3874.1.7
by Vincent Ladeuil
Restrict '-v' change to log --short only. |
275 |
# Check that we use the long status format, ignoring the verbosity
|
276 |
# level
|
|
|
3874.1.8
by Vincent Ladeuil
Fixed as ber Robert's review. |
277 |
self.assertUseLongDeltaFormat(['log', '--long', '-v']) |
|
3874.1.4
by Vincent Ladeuil
Fixed as per Aarons' comment. |
278 |
|
279 |
def test_log_long_verbose_verbose(self): |
|
|
3874.1.7
by Vincent Ladeuil
Restrict '-v' change to log --short only. |
280 |
# Check that we use the long status format, ignoring the verbosity
|
281 |
# level
|
|
|
3874.1.8
by Vincent Ladeuil
Fixed as ber Robert's review. |
282 |
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. |
283 |
|
|
3144.7.9
by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors |
284 |
|
285 |
class TestLogMerges(TestCaseWithoutPropsHandler): |
|
|
1624.1.3
by Robert Collins
Convert log to use the new tsort.merge_sort routine. |
286 |
|
|
2466.12.1
by Kent Gibson
Fix ``bzr log -r`` to support selecting merge revisions. |
287 |
def _prepare(self): |
|
2664.14.1
by Daniel Watkins
Fixed tests.blackbox.test_log to use internals where appropriate. |
288 |
parent_tree = self.make_branch_and_tree('parent') |
289 |
parent_tree.commit(message='first post', allow_pointless=True) |
|
290 |
child_tree = parent_tree.bzrdir.sprout('child').open_workingtree() |
|
291 |
child_tree.commit(message='branch 1', allow_pointless=True) |
|
292 |
smaller_tree = \ |
|
293 |
child_tree.bzrdir.sprout('smallerchild').open_workingtree() |
|
294 |
smaller_tree.commit(message='branch 2', allow_pointless=True) |
|
295 |
child_tree.merge_from_branch(smaller_tree.branch) |
|
296 |
child_tree.commit(message='merge branch 2') |
|
297 |
parent_tree.merge_from_branch(child_tree.branch) |
|
298 |
parent_tree.commit(message='merge branch 1') |
|
299 |
os.chdir('parent') |
|
|
2466.12.1
by Kent Gibson
Fix ``bzr log -r`` to support selecting merge revisions. |
300 |
|
301 |
def test_merges_are_indented_by_level(self): |
|
302 |
self._prepare() |
|
|
1624.1.3
by Robert Collins
Convert log to use the new tsort.merge_sort routine. |
303 |
out,err = self.run_bzr('log') |
304 |
self.assertEqual('', err) |
|
|
2978.6.1
by Kent Gibson
Use normalize_log to more accurately test blackbox log output. |
305 |
log = normalize_log(out) |
306 |
self.assertEqualDiff(log, """\ |
|
307 |
------------------------------------------------------------
|
|
308 |
revno: 2
|
|
309 |
committer: Lorem Ipsum <test@example.com>
|
|
310 |
branch nick: parent
|
|
311 |
timestamp: Just now
|
|
312 |
message:
|
|
313 |
merge branch 1
|
|
314 |
------------------------------------------------------------
|
|
315 |
revno: 1.1.2
|
|
316 |
committer: Lorem Ipsum <test@example.com>
|
|
317 |
branch nick: child
|
|
318 |
timestamp: Just now
|
|
319 |
message:
|
|
320 |
merge branch 2
|
|
321 |
------------------------------------------------------------
|
|
|
3170.3.4
by John Arbash Meinel
Update the tests for the new revision numbering. |
322 |
revno: 1.2.1
|
|
2978.6.1
by Kent Gibson
Use normalize_log to more accurately test blackbox log output. |
323 |
committer: Lorem Ipsum <test@example.com>
|
324 |
branch nick: smallerchild
|
|
325 |
timestamp: Just now
|
|
326 |
message:
|
|
327 |
branch 2
|
|
328 |
------------------------------------------------------------
|
|
329 |
revno: 1.1.1
|
|
330 |
committer: Lorem Ipsum <test@example.com>
|
|
331 |
branch nick: child
|
|
332 |
timestamp: Just now
|
|
333 |
message:
|
|
334 |
branch 1
|
|
335 |
------------------------------------------------------------
|
|
336 |
revno: 1
|
|
337 |
committer: Lorem Ipsum <test@example.com>
|
|
338 |
branch nick: parent
|
|
339 |
timestamp: Just now
|
|
340 |
message:
|
|
341 |
first post
|
|
342 |
""") |
|
|
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
343 |
|
|
2466.12.1
by Kent Gibson
Fix ``bzr log -r`` to support selecting merge revisions. |
344 |
def test_merges_single_merge_rev(self): |
345 |
self._prepare() |
|
|
2581.1.6
by Martin Pool
fix up more run_bzr callers |
346 |
out,err = self.run_bzr('log -r1.1.2') |
|
2466.12.1
by Kent Gibson
Fix ``bzr log -r`` to support selecting merge revisions. |
347 |
self.assertEqual('', err) |
|
2978.6.1
by Kent Gibson
Use normalize_log to more accurately test blackbox log output. |
348 |
log = normalize_log(out) |
349 |
self.assertEqualDiff(log, """\ |
|
350 |
------------------------------------------------------------
|
|
351 |
revno: 1.1.2
|
|
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 |
""") |
|
|
2466.12.1
by Kent Gibson
Fix ``bzr log -r`` to support selecting merge revisions. |
365 |
|
366 |
def test_merges_partial_range(self): |
|
367 |
self._prepare() |
|
|
3842.2.5
by Vincent Ladeuil
Better fix for bug #300055. |
368 |
out, err = self.run_bzr('log -r1.1.1..1.1.2') |
|
2466.12.1
by Kent Gibson
Fix ``bzr log -r`` to support selecting merge revisions. |
369 |
self.assertEqual('', err) |
|
2978.6.1
by Kent Gibson
Use normalize_log to more accurately test blackbox log output. |
370 |
log = normalize_log(out) |
371 |
self.assertEqualDiff(log, """\ |
|
372 |
------------------------------------------------------------
|
|
373 |
revno: 1.1.2
|
|
374 |
committer: Lorem Ipsum <test@example.com>
|
|
375 |
branch nick: child
|
|
376 |
timestamp: Just now
|
|
377 |
message:
|
|
378 |
merge branch 2
|
|
379 |
------------------------------------------------------------
|
|
|
3170.3.4
by John Arbash Meinel
Update the tests for the new revision numbering. |
380 |
revno: 1.2.1
|
|
2978.6.1
by Kent Gibson
Use normalize_log to more accurately test blackbox log output. |
381 |
committer: Lorem Ipsum <test@example.com>
|
382 |
branch nick: smallerchild
|
|
383 |
timestamp: Just now
|
|
384 |
message:
|
|
385 |
branch 2
|
|
386 |
------------------------------------------------------------
|
|
387 |
revno: 1.1.1
|
|
388 |
committer: Lorem Ipsum <test@example.com>
|
|
389 |
branch nick: child
|
|
390 |
timestamp: Just now
|
|
391 |
message:
|
|
392 |
branch 1
|
|
393 |
""") |
|
|
2466.12.1
by Kent Gibson
Fix ``bzr log -r`` to support selecting merge revisions. |
394 |
|
|
2978.3.1
by Kent Gibson
Return an error if the revisionspec contains merge revisions, but the log formatter doesn't support them. |
395 |
def test_merges_nonsupporting_formatter(self): |
396 |
self._prepare() |
|
397 |
err_msg = 'Selected log formatter only supports mainline revisions.' |
|
|
2997.1.1
by Kent Gibson
Support logging single merge revisions with short and line log formatters. |
398 |
# The single revision case is tested in the core tests
|
399 |
# since all standard formatters support single merge revisions.
|
|
|
2978.3.1
by Kent Gibson
Return an error if the revisionspec contains merge revisions, but the log formatter doesn't support them. |
400 |
out,err = self.run_bzr('log --short -r1..1.1.2', retcode=3) |
401 |
self.assertContainsRe(err, err_msg) |
|
402 |
out,err = self.run_bzr('log --short -r1.1.1..1.1.2', retcode=3) |
|
403 |
self.assertContainsRe(err, err_msg) |
|
404 |
||
|
3842.2.5
by Vincent Ladeuil
Better fix for bug #300055. |
405 |
|
|
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
406 |
class TestLogEncodings(TestCaseInTempDir): |
407 |
||
408 |
_mu = u'\xb5' |
|
409 |
_message = u'Message with \xb5' |
|
410 |
||
411 |
# Encodings which can encode mu
|
|
412 |
good_encodings = [ |
|
413 |
'utf-8', |
|
414 |
'latin-1', |
|
415 |
'iso-8859-1', |
|
416 |
'cp437', # Common windows encoding |
|
417 |
'cp1251', # Alexander Belchenko's windows encoding |
|
418 |
'cp1258', # Common windows encoding |
|
419 |
]
|
|
420 |
# Encodings which cannot encode mu
|
|
421 |
bad_encodings = [ |
|
422 |
'ascii', |
|
423 |
'iso-8859-2', |
|
424 |
'koi8_r', |
|
425 |
]
|
|
426 |
||
427 |
def setUp(self): |
|
428 |
TestCaseInTempDir.setUp(self) |
|
|
3224.5.4
by Andrew Bennetts
Fix test suite, mainly weeding out uses of bzrlib.user_encoding. |
429 |
self.user_encoding = osutils._cached_user_encoding |
|
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
430 |
|
431 |
def tearDown(self): |
|
|
3224.5.4
by Andrew Bennetts
Fix test suite, mainly weeding out uses of bzrlib.user_encoding. |
432 |
osutils._cached_user_encoding = self.user_encoding |
|
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
433 |
TestCaseInTempDir.tearDown(self) |
434 |
||
435 |
def create_branch(self): |
|
436 |
bzr = self.run_bzr |
|
437 |
bzr('init') |
|
438 |
open('a', 'wb').write('some stuff\n') |
|
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
439 |
bzr('add a') |
440 |
bzr(['commit', '-m', self._message]) |
|
|
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
441 |
|
442 |
def try_encoding(self, encoding, fail=False): |
|
443 |
bzr = self.run_bzr |
|
444 |
if fail: |
|
445 |
self.assertRaises(UnicodeEncodeError, |
|
446 |
self._mu.encode, encoding) |
|
447 |
encoded_msg = self._message.encode(encoding, 'replace') |
|
448 |
else: |
|
449 |
encoded_msg = self._message.encode(encoding) |
|
450 |
||
|
3224.5.4
by Andrew Bennetts
Fix test suite, mainly weeding out uses of bzrlib.user_encoding. |
451 |
old_encoding = osutils._cached_user_encoding |
|
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
452 |
# This test requires that 'run_bzr' uses the current
|
453 |
# bzrlib, because we override user_encoding, and expect
|
|
454 |
# it to be used
|
|
455 |
try: |
|
|
3224.5.4
by Andrew Bennetts
Fix test suite, mainly weeding out uses of bzrlib.user_encoding. |
456 |
osutils._cached_user_encoding = 'ascii' |
|
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
457 |
# We should be able to handle any encoding
|
458 |
out, err = bzr('log', encoding=encoding) |
|
459 |
if not fail: |
|
460 |
# Make sure we wrote mu as we expected it to exist
|
|
461 |
self.assertNotEqual(-1, out.find(encoded_msg)) |
|
462 |
out_unicode = out.decode(encoding) |
|
463 |
self.assertNotEqual(-1, out_unicode.find(self._message)) |
|
464 |
else: |
|
465 |
self.assertNotEqual(-1, out.find('Message with ?')) |
|
466 |
finally: |
|
|
3224.5.4
by Andrew Bennetts
Fix test suite, mainly weeding out uses of bzrlib.user_encoding. |
467 |
osutils._cached_user_encoding = old_encoding |
|
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
468 |
|
469 |
def test_log_handles_encoding(self): |
|
470 |
self.create_branch() |
|
471 |
||
472 |
for encoding in self.good_encodings: |
|
473 |
self.try_encoding(encoding) |
|
474 |
||
475 |
def test_log_handles_bad_encoding(self): |
|
476 |
self.create_branch() |
|
477 |
||
478 |
for encoding in self.bad_encodings: |
|
479 |
self.try_encoding(encoding, fail=True) |
|
480 |
||
481 |
def test_stdout_encoding(self): |
|
482 |
bzr = self.run_bzr |
|
|
3224.5.4
by Andrew Bennetts
Fix test suite, mainly weeding out uses of bzrlib.user_encoding. |
483 |
osutils._cached_user_encoding = "cp1251" |
|
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
484 |
|
485 |
bzr('init') |
|
486 |
self.build_tree(['a']) |
|
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
487 |
bzr('add a') |
488 |
bzr(['commit', '-m', u'\u0422\u0435\u0441\u0442']) |
|
|
1685.1.5
by John Arbash Meinel
Merged test_log.py.moved into test_log.py |
489 |
stdout, stderr = self.run_bzr('log', encoding='cp866') |
490 |
||
491 |
message = stdout.splitlines()[-1] |
|
492 |
||
493 |
# explanation of the check:
|
|
494 |
# u'\u0422\u0435\u0441\u0442' is word 'Test' in russian
|
|
495 |
# in cp866 encoding this is string '\x92\xa5\xe1\xe2'
|
|
496 |
# in cp1251 encoding this is string '\xd2\xe5\xf1\xf2'
|
|
497 |
# This test should check that output of log command
|
|
498 |
# encoded to sys.stdout.encoding
|
|
499 |
test_in_cp866 = '\x92\xa5\xe1\xe2' |
|
500 |
test_in_cp1251 = '\xd2\xe5\xf1\xf2' |
|
501 |
# Make sure the log string is encoded in cp866
|
|
502 |
self.assertEquals(test_in_cp866, message[2:]) |
|
503 |
# Make sure the cp1251 string is not found anywhere
|
|
504 |
self.assertEquals(-1, stdout.find(test_in_cp1251)) |
|
505 |
||
|
1551.10.18
by Aaron Bentley
Log works in local treeless branches (#84247) |
506 |
|
507 |
class TestLogFile(TestCaseWithTransport): |
|
508 |
||
509 |
def test_log_local_branch_file(self): |
|
510 |
"""We should be able to log files in local treeless branches""" |
|
511 |
tree = self.make_branch_and_tree('tree') |
|
512 |
self.build_tree(['tree/file']) |
|
513 |
tree.add('file') |
|
514 |
tree.commit('revision 1') |
|
515 |
tree.bzrdir.destroy_workingtree() |
|
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
516 |
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. |
517 |
|
518 |
def test_log_file(self): |
|
519 |
"""The log for a particular file should only list revs for that file""" |
|
520 |
tree = self.make_branch_and_tree('parent') |
|
521 |
self.build_tree(['parent/file1', 'parent/file2', 'parent/file3']) |
|
522 |
tree.add('file1') |
|
523 |
tree.commit('add file1') |
|
524 |
tree.add('file2') |
|
525 |
tree.commit('add file2') |
|
526 |
tree.add('file3') |
|
527 |
tree.commit('add file3') |
|
|
2664.14.1
by Daniel Watkins
Fixed tests.blackbox.test_log to use internals where appropriate. |
528 |
child_tree = tree.bzrdir.sprout('child').open_workingtree() |
529 |
self.build_tree_contents([('child/file2', 'hello')]) |
|
530 |
child_tree.commit(message='branch 1') |
|
531 |
tree.merge_from_branch(child_tree.branch) |
|
532 |
tree.commit(message='merge child branch') |
|
|
2359.1.1
by Kent Gibson
Fix ``bzr log <file>`` so it only logs the revisions that changed the file, and does it faster. |
533 |
os.chdir('parent') |
|
2581.1.6
by Martin Pool
fix up more run_bzr callers |
534 |
log = self.run_bzr('log 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. |
535 |
self.assertContainsRe(log, 'revno: 1\n') |
536 |
self.assertNotContainsRe(log, 'revno: 2\n') |
|
537 |
self.assertNotContainsRe(log, 'revno: 3\n') |
|
538 |
self.assertNotContainsRe(log, 'revno: 3.1.1\n') |
|
539 |
self.assertNotContainsRe(log, 'revno: 4\n') |
|
|
2581.1.6
by Martin Pool
fix up more run_bzr callers |
540 |
log = self.run_bzr('log 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. |
541 |
self.assertNotContainsRe(log, 'revno: 1\n') |
542 |
self.assertContainsRe(log, 'revno: 2\n') |
|
543 |
self.assertNotContainsRe(log, 'revno: 3\n') |
|
544 |
self.assertContainsRe(log, 'revno: 3.1.1\n') |
|
|
2359.1.2
by Kent Gibson
add logging of merge revisions |
545 |
self.assertContainsRe(log, 'revno: 4\n') |
|
2581.1.6
by Martin Pool
fix up more run_bzr callers |
546 |
log = self.run_bzr('log 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. |
547 |
self.assertNotContainsRe(log, 'revno: 1\n') |
548 |
self.assertNotContainsRe(log, 'revno: 2\n') |
|
549 |
self.assertContainsRe(log, 'revno: 3\n') |
|
550 |
self.assertNotContainsRe(log, 'revno: 3.1.1\n') |
|
551 |
self.assertNotContainsRe(log, 'revno: 4\n') |
|
|
2581.1.6
by Martin Pool
fix up more run_bzr callers |
552 |
log = self.run_bzr('log -r3.1.1 file2')[0] |
|
2466.12.1
by Kent Gibson
Fix ``bzr log -r`` to support selecting merge revisions. |
553 |
self.assertNotContainsRe(log, 'revno: 1\n') |
554 |
self.assertNotContainsRe(log, 'revno: 2\n') |
|
555 |
self.assertNotContainsRe(log, 'revno: 3\n') |
|
556 |
self.assertContainsRe(log, 'revno: 3.1.1\n') |
|
557 |
self.assertNotContainsRe(log, 'revno: 4\n') |
|
|
2581.1.6
by Martin Pool
fix up more run_bzr callers |
558 |
log = self.run_bzr('log -r4 file2')[0] |
559 |
self.assertNotContainsRe(log, 'revno: 1\n') |
|
560 |
self.assertNotContainsRe(log, 'revno: 2\n') |
|
561 |
self.assertNotContainsRe(log, 'revno: 3\n') |
|
562 |
self.assertContainsRe(log, 'revno: 3.1.1\n') |
|
563 |
self.assertContainsRe(log, 'revno: 4\n') |
|
564 |
log = self.run_bzr('log -r3.. file2')[0] |
|
565 |
self.assertNotContainsRe(log, 'revno: 1\n') |
|
566 |
self.assertNotContainsRe(log, 'revno: 2\n') |
|
567 |
self.assertNotContainsRe(log, 'revno: 3\n') |
|
568 |
self.assertContainsRe(log, 'revno: 3.1.1\n') |
|
569 |
self.assertContainsRe(log, 'revno: 4\n') |
|
570 |
log = self.run_bzr('log -r..3 file2')[0] |
|
|
2466.12.1
by Kent Gibson
Fix ``bzr log -r`` to support selecting merge revisions. |
571 |
self.assertNotContainsRe(log, 'revno: 1\n') |
572 |
self.assertContainsRe(log, 'revno: 2\n') |
|
573 |
self.assertNotContainsRe(log, 'revno: 3\n') |
|
574 |
self.assertNotContainsRe(log, 'revno: 3.1.1\n') |
|
575 |
self.assertNotContainsRe(log, 'revno: 4\n') |