bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
6614.1.3
by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual. |
1 |
# Copyright (C) 2005-2013, 2016 Canonical Ltd
|
|
1685.1.80
by Wouter van Heyst
more code cleanup |
2 |
#
|
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
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.
|
|
|
1685.1.80
by Wouter van Heyst
more code cleanup |
7 |
#
|
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
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.
|
|
|
1685.1.80
by Wouter van Heyst
more code cleanup |
12 |
#
|
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
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
|
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
16 |
|
17 |
import os |
|
|
7182.1.4
by Jelmer Vernooij
Print exceptions when custom handlers raise exceptions rather than aborting. |
18 |
import re |
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
19 |
|
|
6624
by Jelmer Vernooij
Merge Python3 porting work ('py3 pokes') |
20 |
from .. import ( |
|
5097.1.12
by Vincent Ladeuil
Implement the --exclude-common-ancestry log option. |
21 |
branchbuilder, |
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
22 |
errors, |
23 |
log, |
|
24 |
registry, |
|
25 |
revision, |
|
26 |
revisionspec, |
|
27 |
tests, |
|
|
6583.4.5
by Reagan Sanders
Added a test case covering the possibility of UTF-8 characters within the name portion of a GPG key. This can happen during a 'bzr log --signatures' command. |
28 |
gpg, |
29 |
trace, |
|
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
30 |
)
|
|
6624
by Jelmer Vernooij
Merge Python3 porting work ('py3 pokes') |
31 |
from ..sixish import ( |
|
6621.22.2
by Martin
Use BytesIO or StringIO from bzrlib.sixish |
32 |
BytesIO, |
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
33 |
StringIO, |
|
7029.4.8
by Jelmer Vernooij
Merge trunk. |
34 |
unichr, |
|
6621.22.2
by Martin
Use BytesIO or StringIO from bzrlib.sixish |
35 |
)
|
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
36 |
|
37 |
||
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
38 |
class TestLogMixin(object): |
39 |
||
40 |
def wt_commit(self, wt, message, **kwargs): |
|
41 |
"""Use some mostly fixed values for commits to simplify tests. |
|
42 |
||
43 |
Tests can use this function to get some commit attributes. The time
|
|
44 |
stamp is incremented at each commit.
|
|
45 |
"""
|
|
46 |
if getattr(self, 'timestamp', None) is None: |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
47 |
self.timestamp = 1132617600 # Mon 2005-11-22 00:00:00 +0000 |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
48 |
else: |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
49 |
self.timestamp += 1 # 1 second between each commit |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
50 |
kwargs.setdefault('timestamp', self.timestamp) |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
51 |
kwargs.setdefault('timezone', 0) # UTC |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
52 |
kwargs.setdefault('committer', 'Joe Foo <joe@foo.com>') |
53 |
||
54 |
return wt.commit(message, **kwargs) |
|
55 |
||
56 |
||
57 |
class TestCaseForLogFormatter(tests.TestCaseWithTransport, TestLogMixin): |
|
|
3144.7.9
by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors |
58 |
|
59 |
def setUp(self): |
|
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
60 |
super(TestCaseForLogFormatter, self).setUp() |
|
3144.7.9
by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors |
61 |
# keep a reference to the "current" custom prop. handler registry
|
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
62 |
self.properties_handler_registry = log.properties_handler_registry |
|
4325.4.3
by Vincent Ladeuil
More cleanups. |
63 |
# Use a clean registry for log
|
|
3144.7.9
by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors |
64 |
log.properties_handler_registry = registry.Registry() |
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
65 |
|
|
4325.4.3
by Vincent Ladeuil
More cleanups. |
66 |
def restore(): |
67 |
log.properties_handler_registry = self.properties_handler_registry |
|
68 |
self.addCleanup(restore) |
|
|
3144.7.9
by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors |
69 |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
70 |
def assertFormatterResult(self, result, branch, formatter_class, |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
71 |
formatter_kwargs=None, show_log_kwargs=None): |
|
4857.4.5
by John Arbash Meinel
We don't need the utf8 option, no test actually wanted to run without it, |
72 |
logfile = self.make_utf8_encoded_stringio() |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
73 |
if formatter_kwargs is None: |
74 |
formatter_kwargs = {} |
|
75 |
formatter = formatter_class(to_file=logfile, **formatter_kwargs) |
|
76 |
if show_log_kwargs is None: |
|
77 |
show_log_kwargs = {} |
|
78 |
log.show_log(branch, formatter, **show_log_kwargs) |
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
79 |
self.assertEqualDiff(result, logfile.getvalue()) |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
80 |
|
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
81 |
def make_standard_commit(self, branch_nick, **kwargs): |
82 |
wt = self.make_branch_and_tree('.') |
|
83 |
wt.lock_write() |
|
84 |
self.addCleanup(wt.unlock) |
|
85 |
self.build_tree(['a']) |
|
86 |
wt.add(['a']) |
|
87 |
wt.branch.nick = branch_nick |
|
88 |
kwargs.setdefault('committer', 'Lorem Ipsum <test@example.com>') |
|
89 |
kwargs.setdefault('authors', ['John Doe <jdoe@example.com>']) |
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
90 |
self.wt_commit(wt, 'add a', **kwargs) |
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
91 |
return wt |
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
92 |
|
|
4955.4.1
by Vincent Ladeuil
Refactor the function into an helper. |
93 |
def make_commits_with_trailing_newlines(self, wt): |
94 |
"""Helper method for LogFormatter tests""" |
|
95 |
b = wt.branch |
|
96 |
b.nick = 'test' |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
97 |
self.build_tree_contents([('a', b'hello moto\n')]) |
98 |
self.wt_commit(wt, 'simple log message', rev_id=b'a1') |
|
99 |
self.build_tree_contents([('b', b'goodbye\n')]) |
|
|
4955.4.1
by Vincent Ladeuil
Refactor the function into an helper. |
100 |
wt.add('b') |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
101 |
self.wt_commit(wt, 'multiline\nlog\nmessage\n', rev_id=b'a2') |
|
4955.4.1
by Vincent Ladeuil
Refactor the function into an helper. |
102 |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
103 |
self.build_tree_contents([('c', b'just another manic monday\n')]) |
|
4955.4.1
by Vincent Ladeuil
Refactor the function into an helper. |
104 |
wt.add('c') |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
105 |
self.wt_commit(wt, 'single line with trailing newline\n', rev_id=b'a3') |
|
4955.4.1
by Vincent Ladeuil
Refactor the function into an helper. |
106 |
return b |
107 |
||
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
108 |
def _prepare_tree_with_merges(self, with_tags=False): |
109 |
wt = self.make_branch_and_memory_tree('.') |
|
110 |
wt.lock_write() |
|
111 |
self.addCleanup(wt.unlock) |
|
112 |
wt.add('') |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
113 |
self.wt_commit(wt, 'rev-1', rev_id=b'rev-1') |
114 |
self.wt_commit(wt, 'rev-merged', rev_id=b'rev-2a') |
|
|
6973.10.6
by Jelmer Vernooij
Fix tests. |
115 |
wt.set_parent_ids([b'rev-1', b'rev-2a']) |
116 |
wt.branch.set_last_revision_info(1, b'rev-1') |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
117 |
self.wt_commit(wt, 'rev-2', rev_id=b'rev-2b') |
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
118 |
if with_tags: |
119 |
branch = wt.branch |
|
|
6973.10.6
by Jelmer Vernooij
Fix tests. |
120 |
branch.tags.set_tag('v0.2', b'rev-2b') |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
121 |
self.wt_commit(wt, 'rev-3', rev_id=b'rev-3') |
|
6973.10.6
by Jelmer Vernooij
Fix tests. |
122 |
branch.tags.set_tag('v1.0rc1', b'rev-3') |
123 |
branch.tags.set_tag('v1.0', b'rev-3') |
|
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
124 |
return wt |
125 |
||
|
5691.1.2
by Jelmer Vernooij
Add tests for ghosts in mainline during log. |
126 |
|
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
127 |
class LogCatcher(log.LogFormatter): |
|
4325.4.3
by Vincent Ladeuil
More cleanups. |
128 |
"""Pull log messages into a list rather than displaying them. |
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
129 |
|
|
4325.4.3
by Vincent Ladeuil
More cleanups. |
130 |
To simplify testing we save logged revisions here rather than actually
|
|
4325.4.1
by Vincent Ladeuil
Some cleanups. |
131 |
formatting anything, so that we can precisely check the result without
|
|
4325.4.3
by Vincent Ladeuil
More cleanups. |
132 |
being dependent on the formatting.
|
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
133 |
"""
|
|
2466.8.1
by Kent Gibson
Reworked LogFormatter API to simplify extending the attributes of the revision being logged. Added support for begin_log() and end_log() hooks in LogFormatters. |
134 |
|
|
4955.4.5
by Vincent Ladeuil
Start reproducing the problems reported in the bug. |
135 |
supports_merge_revisions = True |
|
2490.1.2
by John Arbash Meinel
Cleanup according to PEP8 and some other small whitespace fixes |
136 |
supports_delta = True |
|
4955.4.11
by Vincent Ladeuil
Give some tests a better focus and simplify them accordingly. |
137 |
supports_diff = True |
|
4955.4.5
by Vincent Ladeuil
Start reproducing the problems reported in the bug. |
138 |
preferred_levels = 0 |
|
2466.8.1
by Kent Gibson
Reworked LogFormatter API to simplify extending the attributes of the revision being logged. Added support for begin_log() and end_log() hooks in LogFormatters. |
139 |
|
|
4955.4.5
by Vincent Ladeuil
Start reproducing the problems reported in the bug. |
140 |
def __init__(self, *args, **kwargs): |
141 |
kwargs.update(dict(to_file=None)) |
|
142 |
super(LogCatcher, self).__init__(*args, **kwargs) |
|
|
4325.4.4
by Vincent Ladeuil
Clarify LogCatcher purpose. |
143 |
self.revisions = [] |
|
1704.2.20
by Martin Pool
log --line shows revision numbers (Alexander) |
144 |
|
|
2466.8.1
by Kent Gibson
Reworked LogFormatter API to simplify extending the attributes of the revision being logged. Added support for begin_log() and end_log() hooks in LogFormatters. |
145 |
def log_revision(self, revision): |
|
4325.4.4
by Vincent Ladeuil
Clarify LogCatcher purpose. |
146 |
self.revisions.append(revision) |
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
147 |
|
148 |
||
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
149 |
class TestShowLog(tests.TestCaseWithTransport): |
|
1102
by Martin Pool
- merge test refactoring from robertc |
150 |
|
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
151 |
def checkDelta(self, delta, **kw): |
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
152 |
"""Check the filenames touched by a delta are as expected. |
153 |
||
154 |
Caller only have to pass in the list of files for each part, all
|
|
155 |
unspecified parts are considered empty (and checked as such).
|
|
156 |
"""
|
|
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
157 |
for n in 'added', 'removed', 'renamed', 'modified', 'unchanged': |
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
158 |
# By default we expect an empty list
|
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
159 |
expected = kw.get(n, []) |
160 |
# strip out only the path components
|
|
|
7358.11.3
by Jelmer Vernooij
TreeDelta holds TreeChange objects rather than tuples of various sizes. |
161 |
got = [x.path[1] or x.path[0] for x in getattr(delta, n)] |
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
162 |
self.assertEqual(expected, got) |
163 |
||
164 |
def assertInvalidRevisonNumber(self, br, start, end): |
|
165 |
lf = LogCatcher() |
|
166 |
self.assertRaises(errors.InvalidRevisionNumber, |
|
167 |
log.show_log, br, lf, |
|
168 |
start_revision=start, end_revision=end) |
|
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
169 |
|
|
974.1.54
by aaron.bentley at utoronto
Fixed the revno bug in log |
170 |
def test_cur_revno(self): |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
171 |
wt = self.make_branch_and_tree('.') |
172 |
b = wt.branch |
|
|
1092.3.4
by Robert Collins
update symlink branch to integration |
173 |
|
174 |
lf = LogCatcher() |
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
175 |
wt.commit('empty commit') |
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
176 |
log.show_log(b, lf, verbose=True, start_revision=1, end_revision=1) |
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
177 |
|
178 |
# Since there is a single revision in the branch all the combinations
|
|
179 |
# below should fail.
|
|
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
180 |
self.assertInvalidRevisonNumber(b, 2, 1) |
181 |
self.assertInvalidRevisonNumber(b, 1, 2) |
|
182 |
self.assertInvalidRevisonNumber(b, 0, 2) |
|
183 |
self.assertInvalidRevisonNumber(b, -1, 1) |
|
184 |
self.assertInvalidRevisonNumber(b, 1, -1) |
|
|
6965.1.3
by Jelmer Vernooij
Fix test. |
185 |
self.assertInvalidRevisonNumber(b, 1, 0) |
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
186 |
|
187 |
def test_empty_branch(self): |
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
188 |
wt = self.make_branch_and_tree('.') |
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
189 |
|
190 |
lf = LogCatcher() |
|
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
191 |
log.show_log(wt.branch, lf) |
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
192 |
# no entries yet
|
|
4325.4.4
by Vincent Ladeuil
Clarify LogCatcher purpose. |
193 |
self.assertEqual([], lf.revisions) |
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
194 |
|
195 |
def test_empty_commit(self): |
|
196 |
wt = self.make_branch_and_tree('.') |
|
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
197 |
|
|
1534.4.36
by Robert Collins
Finish deprecating Branch.working_tree() |
198 |
wt.commit('empty commit') |
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
199 |
lf = LogCatcher() |
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
200 |
log.show_log(wt.branch, lf, verbose=True) |
|
4325.4.4
by Vincent Ladeuil
Clarify LogCatcher purpose. |
201 |
revs = lf.revisions |
202 |
self.assertEqual(1, len(revs)) |
|
203 |
self.assertEqual('1', revs[0].revno) |
|
204 |
self.assertEqual('empty commit', revs[0].rev.message) |
|
205 |
self.checkDelta(revs[0].delta) |
|
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
206 |
|
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
207 |
def test_simple_commit(self): |
208 |
wt = self.make_branch_and_tree('.') |
|
209 |
wt.commit('empty commit') |
|
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
210 |
self.build_tree(['hello']) |
|
1534.4.36
by Robert Collins
Finish deprecating Branch.working_tree() |
211 |
wt.add('hello') |
|
2717.1.1
by Lukáš Lalinsky
Use UTF-8 encoded StringIO for log tests to avoid failures on non-ASCII committer names. |
212 |
wt.commit('add one file', |
213 |
committer=u'\u013d\xf3r\xe9m \xcdp\u0161\xfam ' |
|
214 |
u'<test@example.com>') |
|
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
215 |
lf = LogCatcher() |
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
216 |
log.show_log(wt.branch, lf, verbose=True) |
|
4325.4.4
by Vincent Ladeuil
Clarify LogCatcher purpose. |
217 |
self.assertEqual(2, len(lf.revisions)) |
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
218 |
# first one is most recent
|
|
4325.4.4
by Vincent Ladeuil
Clarify LogCatcher purpose. |
219 |
log_entry = lf.revisions[0] |
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
220 |
self.assertEqual('2', log_entry.revno) |
221 |
self.assertEqual('add one file', log_entry.rev.message) |
|
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
222 |
self.checkDelta(log_entry.delta, added=['hello']) |
|
3831.1.6
by John Arbash Meinel
For the simple-log tests, avoid using '\r' in the test. |
223 |
|
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
224 |
def test_commit_message_with_control_chars(self): |
225 |
wt = self.make_branch_and_tree('.') |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
226 |
msg = u"All 8-bit chars: " + ''.join([unichr(x) for x in range(256)]) |
|
3831.1.6
by John Arbash Meinel
For the simple-log tests, avoid using '\r' in the test. |
227 |
msg = msg.replace(u'\r', u'\n') |
|
1534.4.36
by Robert Collins
Finish deprecating Branch.working_tree() |
228 |
wt.commit(msg) |
|
1185.11.5
by John Arbash Meinel
Merged up-to-date against mainline, still broken. |
229 |
lf = LogCatcher() |
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
230 |
log.show_log(wt.branch, lf, verbose=True) |
|
4325.4.4
by Vincent Ladeuil
Clarify LogCatcher purpose. |
231 |
committed_msg = lf.revisions[0].rev.message |
|
4627.1.1
by Robert Collins
Review feedback per IanC. |
232 |
if wt.branch.repository._serializer.squashes_xml_invalid_characters: |
233 |
self.assertNotEqual(msg, committed_msg) |
|
234 |
self.assertTrue(len(committed_msg) > len(msg)) |
|
235 |
else: |
|
236 |
self.assertEqual(msg, committed_msg) |
|
|
1393.4.2
by Harald Meland
Cleanup + better test of commit-msg control character escape code. |
237 |
|
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
238 |
def test_commit_message_without_control_chars(self): |
239 |
wt = self.make_branch_and_tree('.') |
|
|
1393.4.2
by Harald Meland
Cleanup + better test of commit-msg control character escape code. |
240 |
# escaped. As ElementTree apparently does some kind of
|
241 |
# newline conversion, neither LF (\x0A) nor CR (\x0D) are
|
|
242 |
# included in the test commit message, even though they are
|
|
243 |
# valid XML 1.0 characters.
|
|
244 |
msg = "\x09" + ''.join([unichr(x) for x in range(0x20, 256)]) |
|
|
1534.4.36
by Robert Collins
Finish deprecating Branch.working_tree() |
245 |
wt.commit(msg) |
|
1393.4.2
by Harald Meland
Cleanup + better test of commit-msg control character escape code. |
246 |
lf = LogCatcher() |
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
247 |
log.show_log(wt.branch, lf, verbose=True) |
|
4325.4.4
by Vincent Ladeuil
Clarify LogCatcher purpose. |
248 |
committed_msg = lf.revisions[0].rev.message |
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
249 |
self.assertEqual(msg, committed_msg) |
|
1185.31.22
by John Arbash Meinel
[merge] bzr.dev |
250 |
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
251 |
def test_deltas_in_merge_revisions(self): |
252 |
"""Check deltas created for both mainline and merge revisions""" |
|
253 |
wt = self.make_branch_and_tree('parent') |
|
254 |
self.build_tree(['parent/file1', 'parent/file2', 'parent/file3']) |
|
255 |
wt.add('file1') |
|
256 |
wt.add('file2') |
|
257 |
wt.commit(message='add file1 and file2') |
|
|
2581.1.6
by Martin Pool
fix up more run_bzr callers |
258 |
self.run_bzr('branch parent child') |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
259 |
os.unlink('child/file1') |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
260 |
with open('child/file2', 'wb') as f: |
261 |
f.write(b'hello\n') |
|
|
2581.1.6
by Martin Pool
fix up more run_bzr callers |
262 |
self.run_bzr(['commit', '-m', 'remove file1 and modify file2', |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
263 |
'child']) |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
264 |
os.chdir('parent') |
|
2581.1.6
by Martin Pool
fix up more run_bzr callers |
265 |
self.run_bzr('merge ../child') |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
266 |
wt.commit('merge child branch') |
267 |
os.chdir('..') |
|
268 |
b = wt.branch |
|
269 |
lf = LogCatcher() |
|
270 |
lf.supports_merge_revisions = True |
|
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
271 |
log.show_log(b, lf, verbose=True) |
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
272 |
|
|
4325.4.4
by Vincent Ladeuil
Clarify LogCatcher purpose. |
273 |
revs = lf.revisions |
274 |
self.assertEqual(3, len(revs)) |
|
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
275 |
|
|
4325.4.4
by Vincent Ladeuil
Clarify LogCatcher purpose. |
276 |
logentry = revs[0] |
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
277 |
self.assertEqual('2', logentry.revno) |
278 |
self.assertEqual('merge child branch', logentry.rev.message) |
|
279 |
self.checkDelta(logentry.delta, removed=['file1'], modified=['file2']) |
|
280 |
||
|
4325.4.4
by Vincent Ladeuil
Clarify LogCatcher purpose. |
281 |
logentry = revs[1] |
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
282 |
self.assertEqual('1.1.1', logentry.revno) |
283 |
self.assertEqual('remove file1 and modify file2', logentry.rev.message) |
|
284 |
self.checkDelta(logentry.delta, removed=['file1'], modified=['file2']) |
|
285 |
||
|
4325.4.4
by Vincent Ladeuil
Clarify LogCatcher purpose. |
286 |
logentry = revs[2] |
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
287 |
self.assertEqual('1', logentry.revno) |
288 |
self.assertEqual('add file1 and file2', logentry.rev.message) |
|
289 |
self.checkDelta(logentry.delta, added=['file1', 'file2']) |
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
290 |
|
|
6129.2.1
by Martin von Gagern
Test case exposing bug #842695. |
291 |
def test_bug_842695_log_restricted_to_dir(self): |
292 |
# Comments here indicate revision numbers in trunk # VVVVV
|
|
293 |
trunk = self.make_branch_and_tree('this') |
|
294 |
trunk.commit('initial trunk') # 1 |
|
|
6833.5.1
by Jelmer Vernooij
Merge lp:~gagern/bzr/bug842695-log-dir. |
295 |
adder = trunk.controldir.sprout('adder').open_workingtree() |
296 |
merger = trunk.controldir.sprout('merger').open_workingtree() |
|
|
6129.2.1
by Martin von Gagern
Test case exposing bug #842695. |
297 |
self.build_tree_contents([ |
298 |
('adder/dir/',), |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
299 |
('adder/dir/file', b'foo'), |
|
6129.2.1
by Martin von Gagern
Test case exposing bug #842695. |
300 |
])
|
301 |
adder.add(['dir', 'dir/file']) |
|
302 |
adder.commit('added dir') # 1.1.1 |
|
303 |
trunk.merge_from_branch(adder.branch) |
|
304 |
trunk.commit('merged adder into trunk') # 2 |
|
305 |
merger.merge_from_branch(trunk.branch) |
|
306 |
merger.commit('merged trunk into merger') # 1.2.1 |
|
307 |
# Commits are processed in increments of 200 revisions, so
|
|
308 |
# make sure the two merges into trunk are in different chunks.
|
|
|
7029.4.8
by Jelmer Vernooij
Merge trunk. |
309 |
for i in range(200): |
|
6129.2.1
by Martin von Gagern
Test case exposing bug #842695. |
310 |
trunk.commit('intermediate commit %d' % i) # 3-202 |
311 |
trunk.merge_from_branch(merger.branch) |
|
312 |
trunk.commit('merged merger into trunk') # 203 |
|
313 |
file_id = trunk.path2id('dir') |
|
314 |
lf = LogCatcher() |
|
315 |
lf.supports_merge_revisions = True |
|
316 |
log.show_log(trunk.branch, lf, file_id) |
|
|
6833.5.1
by Jelmer Vernooij
Merge lp:~gagern/bzr/bug842695-log-dir. |
317 |
try: |
318 |
self.assertEqual(['2', '1.1.1'], [r.revno for r in lf.revisions]) |
|
319 |
except AssertionError: |
|
320 |
raise tests.KnownFailure("bug #842695") |
|
321 |
||
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
322 |
|
|
6583.4.5
by Reagan Sanders
Added a test case covering the possibility of UTF-8 characters within the name portion of a GPG key. This can happen during a 'bzr log --signatures' command. |
323 |
class TestFormatSignatureValidity(tests.TestCaseWithTransport): |
|
6883.11.3
by Jelmer Vernooij
Fix tests. |
324 |
|
325 |
def verify_revision_signature(self, revid, gpg_strategy): |
|
326 |
return (gpg.SIGNATURE_VALID, |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
327 |
u'UTF8 Test \xa1\xb1\xc1\xd1\xe1\xf1 <jrandom@example.com>') |
|
6583.4.5
by Reagan Sanders
Added a test case covering the possibility of UTF-8 characters within the name portion of a GPG key. This can happen during a 'bzr log --signatures' command. |
328 |
|
329 |
def test_format_signature_validity_utf(self): |
|
330 |
"""Check that GPG signatures containing UTF-8 names are formatted |
|
331 |
correctly."""
|
|
332 |
wt = self.make_branch_and_tree('.') |
|
333 |
revid = wt.commit('empty commit') |
|
334 |
repo = wt.branch.repository |
|
335 |
# Monkey patch out checking if this rev is actually signed, since we
|
|
336 |
# can't sign it without a heavier TestCase and LoopbackGPGStrategy
|
|
337 |
# doesn't care anyways.
|
|
|
6883.11.3
by Jelmer Vernooij
Fix tests. |
338 |
self.overrideAttr(repo, 'verify_revision_signature', |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
339 |
self.verify_revision_signature) |
|
6767.1.2
by Jelmer Vernooij
Fix a test. |
340 |
out = log.format_signature_validity(revid, wt.branch) |
|
6583.4.5
by Reagan Sanders
Added a test case covering the possibility of UTF-8 characters within the name portion of a GPG key. This can happen during a 'bzr log --signatures' command. |
341 |
self.assertEqual( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
342 |
u'valid signature from UTF8 Test \xa1\xb1\xc1\xd1\xe1\xf1 <jrandom@example.com>', |
343 |
out) |
|
|
6129.2.1
by Martin von Gagern
Test case exposing bug #842695. |
344 |
|
|
6583.4.5
by Reagan Sanders
Added a test case covering the possibility of UTF-8 characters within the name portion of a GPG key. This can happen during a 'bzr log --signatures' command. |
345 |
|
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
346 |
class TestShortLogFormatter(TestCaseForLogFormatter): |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
347 |
|
|
1185.31.21
by John Arbash Meinel
Added test for log formatting, found bug when redirecting short logs to a file instead of stdout. |
348 |
def test_trailing_newlines(self): |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
349 |
wt = self.make_branch_and_tree('.') |
|
4955.4.1
by Vincent Ladeuil
Refactor the function into an helper. |
350 |
b = self.make_commits_with_trailing_newlines(wt) |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
351 |
self.assertFormatterResult(b"""\ |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
352 |
3 Joe Foo\t2005-11-22 |
|
1185.31.21
by John Arbash Meinel
Added test for log formatting, found bug when redirecting short logs to a file instead of stdout. |
353 |
single line with trailing newline
|
354 |
||
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
355 |
2 Joe Foo\t2005-11-22 |
|
1185.31.21
by John Arbash Meinel
Added test for log formatting, found bug when redirecting short logs to a file instead of stdout. |
356 |
multiline
|
357 |
log
|
|
358 |
message
|
|
359 |
||
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
360 |
1 Joe Foo\t2005-11-22 |
|
1185.31.21
by John Arbash Meinel
Added test for log formatting, found bug when redirecting short logs to a file instead of stdout. |
361 |
simple log message
|
362 |
||
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
363 |
""", |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
364 |
b, log.ShortLogFormatter) |
|
1185.31.21
by John Arbash Meinel
Added test for log formatting, found bug when redirecting short logs to a file instead of stdout. |
365 |
|
|
2997.1.1
by Kent Gibson
Support logging single merge revisions with short and line log formatters. |
366 |
def test_short_log_with_merges(self): |
|
3946.3.2
by Ian Clatworthy
add tests & NEWS item |
367 |
wt = self._prepare_tree_with_merges() |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
368 |
self.assertFormatterResult(b"""\ |
|
2997.1.1
by Kent Gibson
Support logging single merge revisions with short and line log formatters. |
369 |
2 Joe Foo\t2005-11-22 [merge] |
370 |
rev-2
|
|
371 |
||
372 |
1 Joe Foo\t2005-11-22 |
|
373 |
rev-1
|
|
374 |
||
|
4221.2.3
by Ian Clatworthy
jam feedback: don't show advice if --levels explicitly given |
375 |
""", |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
376 |
wt.branch, log.ShortLogFormatter) |
|
4221.2.3
by Ian Clatworthy
jam feedback: don't show advice if --levels explicitly given |
377 |
|
378 |
def test_short_log_with_merges_and_advice(self): |
|
379 |
wt = self._prepare_tree_with_merges() |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
380 |
self.assertFormatterResult(b"""\ |
|
4221.2.3
by Ian Clatworthy
jam feedback: don't show advice if --levels explicitly given |
381 |
2 Joe Foo\t2005-11-22 [merge] |
382 |
rev-2
|
|
383 |
||
384 |
1 Joe Foo\t2005-11-22 |
|
385 |
rev-1
|
|
386 |
||
|
6123.11.13
by Martin von Gagern
Rename --include-sidelines to --include-merged. |
387 |
Use --include-merged or -n0 to see merged revisions.
|
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
388 |
""", |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
389 |
wt.branch, log.ShortLogFormatter, |
390 |
formatter_kwargs=dict(show_advice=True)) |
|
|
2997.1.1
by Kent Gibson
Support logging single merge revisions with short and line log formatters. |
391 |
|
|
3943.4.2
by John Arbash Meinel
Add a test case which exercises this code path. |
392 |
def test_short_log_with_merges_and_range(self): |
|
4955.4.19
by Vincent Ladeuil
Less code duplication. |
393 |
wt = self._prepare_tree_with_merges() |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
394 |
self.wt_commit(wt, 'rev-3a', rev_id=b'rev-3a') |
|
6973.10.6
by Jelmer Vernooij
Fix tests. |
395 |
wt.branch.set_last_revision_info(2, b'rev-2b') |
396 |
wt.set_parent_ids([b'rev-2b', b'rev-3a']) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
397 |
self.wt_commit(wt, 'rev-3b', rev_id=b'rev-3b') |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
398 |
self.assertFormatterResult(b"""\ |
|
3943.4.2
by John Arbash Meinel
Add a test case which exercises this code path. |
399 |
3 Joe Foo\t2005-11-22 [merge] |
400 |
rev-3b
|
|
401 |
||
402 |
2 Joe Foo\t2005-11-22 [merge] |
|
|
4955.4.19
by Vincent Ladeuil
Less code duplication. |
403 |
rev-2
|
|
3943.4.2
by John Arbash Meinel
Add a test case which exercises this code path. |
404 |
|
405 |
""", |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
406 |
wt.branch, log.ShortLogFormatter, |
407 |
show_log_kwargs=dict(start_revision=2, end_revision=3)) |
|
|
3943.4.2
by John Arbash Meinel
Add a test case which exercises this code path. |
408 |
|
|
3946.3.2
by Ian Clatworthy
add tests & NEWS item |
409 |
def test_short_log_with_tags(self): |
410 |
wt = self._prepare_tree_with_merges(with_tags=True) |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
411 |
self.assertFormatterResult(b"""\ |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
412 |
3 Joe Foo\t2005-11-22 {v1.0, v1.0rc1} |
|
3946.3.2
by Ian Clatworthy
add tests & NEWS item |
413 |
rev-3
|
414 |
||
415 |
2 Joe Foo\t2005-11-22 {v0.2} [merge] |
|
416 |
rev-2
|
|
417 |
||
418 |
1 Joe Foo\t2005-11-22 |
|
419 |
rev-1
|
|
420 |
||
421 |
""", |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
422 |
wt.branch, log.ShortLogFormatter) |
|
3946.3.2
by Ian Clatworthy
add tests & NEWS item |
423 |
|
|
2997.1.1
by Kent Gibson
Support logging single merge revisions with short and line log formatters. |
424 |
def test_short_log_single_merge_revision(self): |
|
4955.4.19
by Vincent Ladeuil
Less code duplication. |
425 |
wt = self._prepare_tree_with_merges() |
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
426 |
revspec = revisionspec.RevisionSpec.from_string('1.1.1') |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
427 |
rev = revspec.in_history(wt.branch) |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
428 |
self.assertFormatterResult(b"""\ |
|
3947.1.10
by Ian Clatworthy
review feedback from vila |
429 |
1.1.1 Joe Foo\t2005-11-22 |
430 |
rev-merged
|
|
|
2997.1.1
by Kent Gibson
Support logging single merge revisions with short and line log formatters. |
431 |
|
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
432 |
""", |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
433 |
wt.branch, log.ShortLogFormatter, |
434 |
show_log_kwargs=dict(start_revision=rev, end_revision=rev)) |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
435 |
|
|
5728.1.1
by Matt Giuca
test_log: Added test cases for the --show-ids switch on 'long' and 'short' log |
436 |
def test_show_ids(self): |
437 |
wt = self.make_branch_and_tree('parent') |
|
438 |
self.build_tree(['parent/f1', 'parent/f2']) |
|
|
6809.1.1
by Martin
Apply 2to3 ws_comma fixer |
439 |
wt.add(['f1', 'f2']) |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
440 |
self.wt_commit(wt, 'first post', rev_id=b'a') |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
441 |
child_wt = wt.controldir.sprout('child').open_workingtree() |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
442 |
self.wt_commit(child_wt, 'branch 1 changes', rev_id=b'b') |
|
5728.1.1
by Matt Giuca
test_log: Added test cases for the --show-ids switch on 'long' and 'short' log |
443 |
wt.merge_from_branch(child_wt.branch) |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
444 |
self.wt_commit(wt, 'merge branch 1', rev_id=b'c') |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
445 |
self.assertFormatterResult(b"""\ |
|
5728.1.1
by Matt Giuca
test_log: Added test cases for the --show-ids switch on 'long' and 'short' log |
446 |
2 Joe Foo\t2005-11-22 [merge] |
447 |
revision-id:c
|
|
448 |
merge branch 1
|
|
449 |
||
450 |
1.1.1 Joe Foo\t2005-11-22 |
|
451 |
revision-id:b
|
|
452 |
branch 1 changes
|
|
453 |
||
454 |
1 Joe Foo\t2005-11-22 |
|
455 |
revision-id:a
|
|
456 |
first post
|
|
457 |
||
458 |
""", |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
459 |
wt.branch, log.ShortLogFormatter, |
460 |
formatter_kwargs=dict(levels=0, show_ids=True)) |
|
|
5728.1.1
by Matt Giuca
test_log: Added test cases for the --show-ids switch on 'long' and 'short' log |
461 |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
462 |
|
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
463 |
class TestShortLogFormatterWithMergeRevisions(TestCaseForLogFormatter): |
|
3947.1.2
by Ian Clatworthy
formatter tests |
464 |
|
465 |
def test_short_merge_revs_log_with_merges(self): |
|
|
4955.4.19
by Vincent Ladeuil
Less code duplication. |
466 |
wt = self._prepare_tree_with_merges() |
|
3947.1.7
by Ian Clatworthy
tweak indenting/offsetting for --short given dotted revno lengths |
467 |
# Note that the 1.1.1 indenting is in fact correct given that
|
468 |
# the revision numbers are right justified within 5 characters
|
|
469 |
# for mainline revnos and 9 characters for dotted revnos.
|
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
470 |
self.assertFormatterResult(b"""\ |
|
3947.1.2
by Ian Clatworthy
formatter tests |
471 |
2 Joe Foo\t2005-11-22 [merge] |
472 |
rev-2
|
|
473 |
||
|
3947.1.10
by Ian Clatworthy
review feedback from vila |
474 |
1.1.1 Joe Foo\t2005-11-22 |
475 |
rev-merged
|
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
476 |
|
477 |
1 Joe Foo\t2005-11-22 |
|
478 |
rev-1
|
|
479 |
||
480 |
""", |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
481 |
wt.branch, log.ShortLogFormatter, |
482 |
formatter_kwargs=dict(levels=0)) |
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
483 |
|
484 |
def test_short_merge_revs_log_single_merge_revision(self): |
|
|
4955.4.19
by Vincent Ladeuil
Less code duplication. |
485 |
wt = self._prepare_tree_with_merges() |
|
3947.1.2
by Ian Clatworthy
formatter tests |
486 |
revspec = revisionspec.RevisionSpec.from_string('1.1.1') |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
487 |
rev = revspec.in_history(wt.branch) |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
488 |
self.assertFormatterResult(b"""\ |
|
3947.1.10
by Ian Clatworthy
review feedback from vila |
489 |
1.1.1 Joe Foo\t2005-11-22 |
490 |
rev-merged
|
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
491 |
|
492 |
""", |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
493 |
wt.branch, log.ShortLogFormatter, |
494 |
formatter_kwargs=dict(levels=0), |
|
495 |
show_log_kwargs=dict(start_revision=rev, end_revision=rev)) |
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
496 |
|
497 |
||
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
498 |
class TestLongLogFormatter(TestCaseForLogFormatter): |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
499 |
|
|
1185.33.41
by Martin Pool
Fix regression of 'bzr log -v' - it wasn't showing changed files at all. (#4676) |
500 |
def test_verbose_log(self): |
501 |
"""Verbose log includes changed files |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
502 |
|
|
1185.33.41
by Martin Pool
Fix regression of 'bzr log -v' - it wasn't showing changed files at all. (#4676) |
503 |
bug #4676
|
504 |
"""
|
|
|
4857.4.4
by John Arbash Meinel
One more standard-commit |
505 |
wt = self.make_standard_commit('test_verbose_log', authors=[]) |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
506 |
self.assertFormatterResult(b'''\ |
|
1185.33.41
by Martin Pool
Fix regression of 'bzr log -v' - it wasn't showing changed files at all. (#4676) |
507 |
------------------------------------------------------------
|
508 |
revno: 1
|
|
|
2671.5.7
by Lukáš Lalinsky
Rename get_author to get_apparent_author, revert the long log back to displaying the committer. |
509 |
committer: Lorem Ipsum <test@example.com>
|
|
1185.33.41
by Martin Pool
Fix regression of 'bzr log -v' - it wasn't showing changed files at all. (#4676) |
510 |
branch nick: test_verbose_log
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
511 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
1185.33.41
by Martin Pool
Fix regression of 'bzr log -v' - it wasn't showing changed files at all. (#4676) |
512 |
message:
|
513 |
add a
|
|
514 |
added:
|
|
515 |
a
|
|
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
516 |
''', |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
517 |
wt.branch, log.LongLogFormatter, |
518 |
show_log_kwargs=dict(verbose=True)) |
|
|
1185.85.4
by John Arbash Meinel
currently broken, trying to fix things up. |
519 |
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
520 |
def test_merges_are_indented_by_level(self): |
521 |
wt = self.make_branch_and_tree('parent') |
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
522 |
self.wt_commit(wt, 'first post') |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
523 |
child_wt = wt.controldir.sprout('child').open_workingtree() |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
524 |
self.wt_commit(child_wt, 'branch 1') |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
525 |
smallerchild_wt = wt.controldir.sprout( |
526 |
'smallerchild').open_workingtree() |
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
527 |
self.wt_commit(smallerchild_wt, 'branch 2') |
528 |
child_wt.merge_from_branch(smallerchild_wt.branch) |
|
529 |
self.wt_commit(child_wt, 'merge branch 2') |
|
530 |
wt.merge_from_branch(child_wt.branch) |
|
531 |
self.wt_commit(wt, 'merge branch 1') |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
532 |
self.assertFormatterResult(b"""\ |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
533 |
------------------------------------------------------------
|
|
4208.2.1
by Ian Clatworthy
merge indicators in log --long |
534 |
revno: 2 [merge]
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
535 |
committer: Joe Foo <joe@foo.com>
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
536 |
branch nick: parent
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
537 |
timestamp: Tue 2005-11-22 00:00:04 +0000
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
538 |
message:
|
539 |
merge branch 1
|
|
540 |
------------------------------------------------------------
|
|
|
4208.2.1
by Ian Clatworthy
merge indicators in log --long |
541 |
revno: 1.1.2 [merge]
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
542 |
committer: Joe Foo <joe@foo.com>
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
543 |
branch nick: child
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
544 |
timestamp: Tue 2005-11-22 00:00:03 +0000
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
545 |
message:
|
546 |
merge branch 2
|
|
547 |
------------------------------------------------------------
|
|
|
3170.3.4
by John Arbash Meinel
Update the tests for the new revision numbering. |
548 |
revno: 1.2.1
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
549 |
committer: Joe Foo <joe@foo.com>
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
550 |
branch nick: smallerchild
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
551 |
timestamp: Tue 2005-11-22 00:00:02 +0000
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
552 |
message:
|
553 |
branch 2
|
|
554 |
------------------------------------------------------------
|
|
555 |
revno: 1.1.1
|
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
556 |
committer: Joe Foo <joe@foo.com>
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
557 |
branch nick: child
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
558 |
timestamp: Tue 2005-11-22 00:00:01 +0000
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
559 |
message:
|
560 |
branch 1
|
|
561 |
------------------------------------------------------------
|
|
562 |
revno: 1
|
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
563 |
committer: Joe Foo <joe@foo.com>
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
564 |
branch nick: parent
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
565 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
566 |
message:
|
567 |
first post
|
|
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
568 |
""", |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
569 |
wt.branch, log.LongLogFormatter, |
570 |
formatter_kwargs=dict(levels=0), |
|
571 |
show_log_kwargs=dict(verbose=True)) |
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
572 |
|
573 |
def test_verbose_merge_revisions_contain_deltas(self): |
|
574 |
wt = self.make_branch_and_tree('parent') |
|
575 |
self.build_tree(['parent/f1', 'parent/f2']) |
|
|
6809.1.1
by Martin
Apply 2to3 ws_comma fixer |
576 |
wt.add(['f1', 'f2']) |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
577 |
self.wt_commit(wt, 'first post') |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
578 |
child_wt = wt.controldir.sprout('child').open_workingtree() |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
579 |
os.unlink('child/f1') |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
580 |
self.build_tree_contents([('child/f2', b'hello\n')]) |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
581 |
self.wt_commit(child_wt, 'removed f1 and modified f2') |
582 |
wt.merge_from_branch(child_wt.branch) |
|
583 |
self.wt_commit(wt, 'merge branch 1') |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
584 |
self.assertFormatterResult(b"""\ |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
585 |
------------------------------------------------------------
|
|
4208.2.1
by Ian Clatworthy
merge indicators in log --long |
586 |
revno: 2 [merge]
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
587 |
committer: Joe Foo <joe@foo.com>
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
588 |
branch nick: parent
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
589 |
timestamp: Tue 2005-11-22 00:00:02 +0000
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
590 |
message:
|
591 |
merge branch 1
|
|
592 |
removed:
|
|
593 |
f1
|
|
594 |
modified:
|
|
595 |
f2
|
|
596 |
------------------------------------------------------------
|
|
597 |
revno: 1.1.1
|
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
598 |
committer: Joe Foo <joe@foo.com>
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
599 |
branch nick: child
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
600 |
timestamp: Tue 2005-11-22 00:00:01 +0000
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
601 |
message:
|
602 |
removed f1 and modified f2
|
|
603 |
removed:
|
|
604 |
f1
|
|
605 |
modified:
|
|
606 |
f2
|
|
607 |
------------------------------------------------------------
|
|
608 |
revno: 1
|
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
609 |
committer: Joe Foo <joe@foo.com>
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
610 |
branch nick: parent
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
611 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
612 |
message:
|
613 |
first post
|
|
614 |
added:
|
|
615 |
f1
|
|
616 |
f2
|
|
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
617 |
""", |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
618 |
wt.branch, log.LongLogFormatter, |
619 |
formatter_kwargs=dict(levels=0), |
|
620 |
show_log_kwargs=dict(verbose=True)) |
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
621 |
|
622 |
def test_trailing_newlines(self): |
|
623 |
wt = self.make_branch_and_tree('.') |
|
|
4955.4.1
by Vincent Ladeuil
Refactor the function into an helper. |
624 |
b = self.make_commits_with_trailing_newlines(wt) |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
625 |
self.assertFormatterResult(b"""\ |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
626 |
------------------------------------------------------------
|
627 |
revno: 3
|
|
|
2671.5.7
by Lukáš Lalinsky
Rename get_author to get_apparent_author, revert the long log back to displaying the committer. |
628 |
committer: Joe Foo <joe@foo.com>
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
629 |
branch nick: test
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
630 |
timestamp: Tue 2005-11-22 00:00:02 +0000
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
631 |
message:
|
632 |
single line with trailing newline
|
|
633 |
------------------------------------------------------------
|
|
634 |
revno: 2
|
|
635 |
committer: Joe Foo <joe@foo.com>
|
|
636 |
branch nick: test
|
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
637 |
timestamp: Tue 2005-11-22 00:00:01 +0000
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
638 |
message:
|
639 |
multiline
|
|
640 |
log
|
|
641 |
message
|
|
642 |
------------------------------------------------------------
|
|
643 |
revno: 1
|
|
|
2671.5.7
by Lukáš Lalinsky
Rename get_author to get_apparent_author, revert the long log back to displaying the committer. |
644 |
committer: Joe Foo <joe@foo.com>
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
645 |
branch nick: test
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
646 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
647 |
message:
|
648 |
simple log message
|
|
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
649 |
""", |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
650 |
b, log.LongLogFormatter) |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
651 |
|
|
2671.5.7
by Lukáš Lalinsky
Rename get_author to get_apparent_author, revert the long log back to displaying the committer. |
652 |
def test_author_in_log(self): |
653 |
"""Log includes the author name if it's set in |
|
654 |
the revision properties
|
|
|
2671.2.1
by Lukáš Lalinský
Add --author option to 'bzr commit' to record the author's name, if it's different from the committer. |
655 |
"""
|
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
656 |
wt = self.make_standard_commit('test_author_log', |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
657 |
authors=['John Doe <jdoe@example.com>', |
658 |
'Jane Rey <jrey@example.com>']) |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
659 |
self.assertFormatterResult(b"""\ |
|
2671.2.1
by Lukáš Lalinský
Add --author option to 'bzr commit' to record the author's name, if it's different from the committer. |
660 |
------------------------------------------------------------
|
661 |
revno: 1
|
|
|
4056.2.3
by James Westby
Use a new "authors" revision property to allow multiple authors |
662 |
author: John Doe <jdoe@example.com>, Jane Rey <jrey@example.com>
|
|
2671.5.4
by Lukáš Lalinsky
Replace the committer with the author in log, the committer is displayed only in the long format and only if it's different from the author. |
663 |
committer: Lorem Ipsum <test@example.com>
|
|
2671.2.1
by Lukáš Lalinský
Add --author option to 'bzr commit' to record the author's name, if it's different from the committer. |
664 |
branch nick: test_author_log
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
665 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
2671.2.1
by Lukáš Lalinský
Add --author option to 'bzr commit' to record the author's name, if it's different from the committer. |
666 |
message:
|
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
667 |
add a
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
668 |
""", |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
669 |
wt.branch, log.LongLogFormatter) |
|
2671.2.1
by Lukáš Lalinský
Add --author option to 'bzr commit' to record the author's name, if it's different from the committer. |
670 |
|
|
3144.7.9
by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors |
671 |
def test_properties_in_log(self): |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
672 |
"""Log includes the custom properties returned by the registered |
|
3144.7.9
by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors |
673 |
handlers.
|
674 |
"""
|
|
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
675 |
wt = self.make_standard_commit('test_properties_in_log') |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
676 |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
677 |
def trivial_custom_prop_handler(revision): |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
678 |
return {'test_prop': 'test_value'} |
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
679 |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
680 |
# Cleaned up in setUp()
|
681 |
log.properties_handler_registry.register( |
|
682 |
'trivial_custom_prop_handler', |
|
683 |
trivial_custom_prop_handler) |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
684 |
self.assertFormatterResult(b"""\ |
|
3144.7.9
by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors |
685 |
------------------------------------------------------------
|
686 |
revno: 1
|
|
687 |
test_prop: test_value
|
|
688 |
author: John Doe <jdoe@example.com>
|
|
689 |
committer: Lorem Ipsum <test@example.com>
|
|
|
3144.7.13
by Guillermo Gonzalez
* fixed typo LogFormatter.show_properties in docstring |
690 |
branch nick: test_properties_in_log
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
691 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
3144.7.9
by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors |
692 |
message:
|
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
693 |
add a
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
694 |
""", |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
695 |
wt.branch, log.LongLogFormatter) |
|
3144.7.9
by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors |
696 |
|
|
3976.3.1
by Neil Martinsen-Burrell
Add custom properties handling to short log format |
697 |
def test_properties_in_short_log(self): |
|
4032.1.2
by John Arbash Meinel
Track down a few more files that have trailing whitespace. |
698 |
"""Log includes the custom properties returned by the registered |
|
3976.3.1
by Neil Martinsen-Burrell
Add custom properties handling to short log format |
699 |
handlers.
|
700 |
"""
|
|
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
701 |
wt = self.make_standard_commit('test_properties_in_short_log') |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
702 |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
703 |
def trivial_custom_prop_handler(revision): |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
704 |
return {'test_prop': 'test_value'} |
|
3976.3.1
by Neil Martinsen-Burrell
Add custom properties handling to short log format |
705 |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
706 |
log.properties_handler_registry.register( |
707 |
'trivial_custom_prop_handler', |
|
708 |
trivial_custom_prop_handler) |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
709 |
self.assertFormatterResult(b"""\ |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
710 |
1 John Doe\t2005-11-22 |
|
3976.3.1
by Neil Martinsen-Burrell
Add custom properties handling to short log format |
711 |
test_prop: test_value
|
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
712 |
add a
|
|
3976.3.1
by Neil Martinsen-Burrell
Add custom properties handling to short log format |
713 |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
714 |
""", |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
715 |
wt.branch, log.ShortLogFormatter) |
|
3976.3.1
by Neil Martinsen-Burrell
Add custom properties handling to short log format |
716 |
|
|
3144.7.9
by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors |
717 |
def test_error_in_properties_handler(self): |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
718 |
"""Log includes the custom properties returned by the registered |
|
3144.7.9
by Guillermo Gonzalez
* bzrlib.log.show_roperties don't hide handler errors |
719 |
handlers.
|
720 |
"""
|
|
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
721 |
wt = self.make_standard_commit('error_in_properties_handler', |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
722 |
revprops={u'first_prop': 'first_value'}) |
|
4857.4.5
by John Arbash Meinel
We don't need the utf8 option, no test actually wanted to run without it, |
723 |
sio = self.make_utf8_encoded_stringio() |
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
724 |
formatter = log.LongLogFormatter(to_file=sio) |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
725 |
|
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
726 |
def trivial_custom_prop_handler(revision): |
|
6619.3.9
by Jelmer Vernooij
Run 2to3 standarderror fixer. |
727 |
raise Exception("a test error") |
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
728 |
|
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
729 |
log.properties_handler_registry.register( |
730 |
'trivial_custom_prop_handler', |
|
731 |
trivial_custom_prop_handler) |
|
|
7182.1.4
by Jelmer Vernooij
Print exceptions when custom handlers raise exceptions rather than aborting. |
732 |
log.show_log(wt.branch, formatter) |
733 |
self.assertContainsRe( |
|
|
7182.1.5
by Jelmer Vernooij
Review comments. |
734 |
sio.getvalue(), b'brz: ERROR: Exception: a test error') |
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
735 |
|
|
3144.7.13
by Guillermo Gonzalez
* fixed typo LogFormatter.show_properties in docstring |
736 |
def test_properties_handler_bad_argument(self): |
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
737 |
wt = self.make_standard_commit('bad_argument', |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
738 |
revprops={u'a_prop': 'test_value'}) |
|
4857.4.5
by John Arbash Meinel
We don't need the utf8 option, no test actually wanted to run without it, |
739 |
sio = self.make_utf8_encoded_stringio() |
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
740 |
formatter = log.LongLogFormatter(to_file=sio) |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
741 |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
742 |
def bad_argument_prop_handler(revision): |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
743 |
return {'custom_prop_name': revision.properties['a_prop']} |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
744 |
|
745 |
log.properties_handler_registry.register( |
|
746 |
'bad_argument_prop_handler', |
|
747 |
bad_argument_prop_handler) |
|
748 |
||
749 |
self.assertRaises(AttributeError, formatter.show_properties, |
|
750 |
'a revision', '') |
|
751 |
||
752 |
revision = wt.branch.repository.get_revision(wt.branch.last_revision()) |
|
753 |
formatter.show_properties(revision, '') |
|
|
7182.1.5
by Jelmer Vernooij
Review comments. |
754 |
self.assertEqualDiff(b'custom_prop_name: test_value\n', |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
755 |
sio.getvalue()) |
|
2671.2.1
by Lukáš Lalinský
Add --author option to 'bzr commit' to record the author's name, if it's different from the committer. |
756 |
|
|
5728.1.1
by Matt Giuca
test_log: Added test cases for the --show-ids switch on 'long' and 'short' log |
757 |
def test_show_ids(self): |
758 |
wt = self.make_branch_and_tree('parent') |
|
759 |
self.build_tree(['parent/f1', 'parent/f2']) |
|
|
6809.1.1
by Martin
Apply 2to3 ws_comma fixer |
760 |
wt.add(['f1', 'f2']) |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
761 |
self.wt_commit(wt, 'first post', rev_id=b'a') |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
762 |
child_wt = wt.controldir.sprout('child').open_workingtree() |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
763 |
self.wt_commit(child_wt, 'branch 1 changes', rev_id=b'b') |
|
5728.1.1
by Matt Giuca
test_log: Added test cases for the --show-ids switch on 'long' and 'short' log |
764 |
wt.merge_from_branch(child_wt.branch) |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
765 |
self.wt_commit(wt, 'merge branch 1', rev_id=b'c') |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
766 |
self.assertFormatterResult(b"""\ |
|
5728.1.1
by Matt Giuca
test_log: Added test cases for the --show-ids switch on 'long' and 'short' log |
767 |
------------------------------------------------------------
|
768 |
revno: 2 [merge]
|
|
769 |
revision-id: c
|
|
770 |
parent: a
|
|
771 |
parent: b
|
|
772 |
committer: Joe Foo <joe@foo.com>
|
|
773 |
branch nick: parent
|
|
774 |
timestamp: Tue 2005-11-22 00:00:02 +0000
|
|
775 |
message:
|
|
776 |
merge branch 1
|
|
777 |
------------------------------------------------------------
|
|
778 |
revno: 1.1.1
|
|
779 |
revision-id: b
|
|
780 |
parent: a
|
|
781 |
committer: Joe Foo <joe@foo.com>
|
|
782 |
branch nick: child
|
|
783 |
timestamp: Tue 2005-11-22 00:00:01 +0000
|
|
784 |
message:
|
|
785 |
branch 1 changes
|
|
786 |
------------------------------------------------------------
|
|
787 |
revno: 1
|
|
788 |
revision-id: a
|
|
789 |
committer: Joe Foo <joe@foo.com>
|
|
790 |
branch nick: parent
|
|
791 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
792 |
message:
|
|
793 |
first post
|
|
794 |
""", |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
795 |
wt.branch, log.LongLogFormatter, |
796 |
formatter_kwargs=dict(levels=0, show_ids=True)) |
|
|
5728.1.1
by Matt Giuca
test_log: Added test cases for the --show-ids switch on 'long' and 'short' log |
797 |
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
798 |
|
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
799 |
class TestLongLogFormatterWithoutMergeRevisions(TestCaseForLogFormatter): |
|
3947.1.2
by Ian Clatworthy
formatter tests |
800 |
|
801 |
def test_long_verbose_log(self): |
|
802 |
"""Verbose log includes changed files |
|
|
4032.1.2
by John Arbash Meinel
Track down a few more files that have trailing whitespace. |
803 |
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
804 |
bug #4676
|
805 |
"""
|
|
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
806 |
wt = self.make_standard_commit('test_long_verbose_log', authors=[]) |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
807 |
self.assertFormatterResult(b"""\ |
|
3947.1.2
by Ian Clatworthy
formatter tests |
808 |
------------------------------------------------------------
|
809 |
revno: 1
|
|
810 |
committer: Lorem Ipsum <test@example.com>
|
|
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
811 |
branch nick: test_long_verbose_log
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
812 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
813 |
message:
|
814 |
add a
|
|
815 |
added:
|
|
816 |
a
|
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
817 |
""", |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
818 |
wt.branch, log.LongLogFormatter, |
819 |
formatter_kwargs=dict(levels=1), |
|
820 |
show_log_kwargs=dict(verbose=True)) |
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
821 |
|
822 |
def test_long_verbose_contain_deltas(self): |
|
823 |
wt = self.make_branch_and_tree('parent') |
|
824 |
self.build_tree(['parent/f1', 'parent/f2']) |
|
|
6809.1.1
by Martin
Apply 2to3 ws_comma fixer |
825 |
wt.add(['f1', 'f2']) |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
826 |
self.wt_commit(wt, 'first post') |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
827 |
child_wt = wt.controldir.sprout('child').open_workingtree() |
|
3947.1.2
by Ian Clatworthy
formatter tests |
828 |
os.unlink('child/f1') |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
829 |
self.build_tree_contents([('child/f2', b'hello\n')]) |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
830 |
self.wt_commit(child_wt, 'removed f1 and modified f2') |
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
831 |
wt.merge_from_branch(child_wt.branch) |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
832 |
self.wt_commit(wt, 'merge branch 1') |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
833 |
self.assertFormatterResult(b"""\ |
|
3947.1.2
by Ian Clatworthy
formatter tests |
834 |
------------------------------------------------------------
|
|
4208.2.1
by Ian Clatworthy
merge indicators in log --long |
835 |
revno: 2 [merge]
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
836 |
committer: Joe Foo <joe@foo.com>
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
837 |
branch nick: parent
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
838 |
timestamp: Tue 2005-11-22 00:00:02 +0000
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
839 |
message:
|
840 |
merge branch 1
|
|
841 |
removed:
|
|
842 |
f1
|
|
843 |
modified:
|
|
844 |
f2
|
|
845 |
------------------------------------------------------------
|
|
846 |
revno: 1
|
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
847 |
committer: Joe Foo <joe@foo.com>
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
848 |
branch nick: parent
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
849 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
850 |
message:
|
851 |
first post
|
|
852 |
added:
|
|
853 |
f1
|
|
854 |
f2
|
|
855 |
""", |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
856 |
wt.branch, log.LongLogFormatter, |
857 |
formatter_kwargs=dict(levels=1), |
|
858 |
show_log_kwargs=dict(verbose=True)) |
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
859 |
|
860 |
def test_long_trailing_newlines(self): |
|
861 |
wt = self.make_branch_and_tree('.') |
|
|
4955.4.1
by Vincent Ladeuil
Refactor the function into an helper. |
862 |
b = self.make_commits_with_trailing_newlines(wt) |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
863 |
self.assertFormatterResult(b"""\ |
|
3947.1.2
by Ian Clatworthy
formatter tests |
864 |
------------------------------------------------------------
|
865 |
revno: 3
|
|
866 |
committer: Joe Foo <joe@foo.com>
|
|
867 |
branch nick: test
|
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
868 |
timestamp: Tue 2005-11-22 00:00:02 +0000
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
869 |
message:
|
870 |
single line with trailing newline
|
|
871 |
------------------------------------------------------------
|
|
872 |
revno: 2
|
|
873 |
committer: Joe Foo <joe@foo.com>
|
|
874 |
branch nick: test
|
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
875 |
timestamp: Tue 2005-11-22 00:00:01 +0000
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
876 |
message:
|
877 |
multiline
|
|
878 |
log
|
|
879 |
message
|
|
880 |
------------------------------------------------------------
|
|
881 |
revno: 1
|
|
882 |
committer: Joe Foo <joe@foo.com>
|
|
883 |
branch nick: test
|
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
884 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
885 |
message:
|
886 |
simple log message
|
|
887 |
""", |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
888 |
b, log.LongLogFormatter, |
889 |
formatter_kwargs=dict(levels=1)) |
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
890 |
|
891 |
def test_long_author_in_log(self): |
|
892 |
"""Log includes the author name if it's set in |
|
893 |
the revision properties
|
|
894 |
"""
|
|
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
895 |
wt = self.make_standard_commit('test_author_log') |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
896 |
self.assertFormatterResult(b"""\ |
|
3947.1.2
by Ian Clatworthy
formatter tests |
897 |
------------------------------------------------------------
|
898 |
revno: 1
|
|
899 |
author: John Doe <jdoe@example.com>
|
|
900 |
committer: Lorem Ipsum <test@example.com>
|
|
901 |
branch nick: test_author_log
|
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
902 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
903 |
message:
|
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
904 |
add a
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
905 |
""", |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
906 |
wt.branch, log.LongLogFormatter, |
907 |
formatter_kwargs=dict(levels=1)) |
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
908 |
|
909 |
def test_long_properties_in_log(self): |
|
|
4032.1.2
by John Arbash Meinel
Track down a few more files that have trailing whitespace. |
910 |
"""Log includes the custom properties returned by the registered |
|
3947.1.2
by Ian Clatworthy
formatter tests |
911 |
handlers.
|
912 |
"""
|
|
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
913 |
wt = self.make_standard_commit('test_properties_in_log') |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
914 |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
915 |
def trivial_custom_prop_handler(revision): |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
916 |
return {'test_prop': 'test_value'} |
|
3947.1.2
by Ian Clatworthy
formatter tests |
917 |
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
918 |
log.properties_handler_registry.register( |
919 |
'trivial_custom_prop_handler', |
|
920 |
trivial_custom_prop_handler) |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
921 |
self.assertFormatterResult(b"""\ |
|
3947.1.2
by Ian Clatworthy
formatter tests |
922 |
------------------------------------------------------------
|
923 |
revno: 1
|
|
924 |
test_prop: test_value
|
|
925 |
author: John Doe <jdoe@example.com>
|
|
926 |
committer: Lorem Ipsum <test@example.com>
|
|
927 |
branch nick: test_properties_in_log
|
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
928 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
929 |
message:
|
|
4857.4.2
by John Arbash Meinel
Add a 'make_standard_commit' helper, to remove more code duplication. |
930 |
add a
|
|
4857.4.1
by John Arbash Meinel
Start cleaning up test_log. |
931 |
""", |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
932 |
wt.branch, log.LongLogFormatter, |
933 |
formatter_kwargs=dict(levels=1)) |
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
934 |
|
935 |
||
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
936 |
class TestLineLogFormatter(TestCaseForLogFormatter): |
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
937 |
|
|
1704.2.20
by Martin Pool
log --line shows revision numbers (Alexander) |
938 |
def test_line_log(self): |
939 |
"""Line log should show revno |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
940 |
|
|
1704.2.20
by Martin Pool
log --line shows revision numbers (Alexander) |
941 |
bug #5162
|
942 |
"""
|
|
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
943 |
wt = self.make_standard_commit('test-line-log', |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
944 |
committer='Line-Log-Formatter Tester <test@line.log>', |
945 |
authors=[]) |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
946 |
self.assertFormatterResult(b"""\ |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
947 |
1: Line-Log-Formatte... 2005-11-22 add a
|
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
948 |
""", |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
949 |
wt.branch, log.LineLogFormatter) |
|
1756.2.20
by Aaron Bentley
Optimize log formats that don't show merges |
950 |
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
951 |
def test_trailing_newlines(self): |
952 |
wt = self.make_branch_and_tree('.') |
|
|
4955.4.1
by Vincent Ladeuil
Refactor the function into an helper. |
953 |
b = self.make_commits_with_trailing_newlines(wt) |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
954 |
self.assertFormatterResult(b"""\ |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
955 |
3: Joe Foo 2005-11-22 single line with trailing newline
|
956 |
2: Joe Foo 2005-11-22 multiline
|
|
957 |
1: Joe Foo 2005-11-22 simple log message
|
|
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
958 |
""", |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
959 |
b, log.LineLogFormatter) |
|
3946.3.2
by Ian Clatworthy
add tests & NEWS item |
960 |
|
|
2997.1.1
by Kent Gibson
Support logging single merge revisions with short and line log formatters. |
961 |
def test_line_log_single_merge_revision(self): |
|
3946.3.2
by Ian Clatworthy
add tests & NEWS item |
962 |
wt = self._prepare_tree_with_merges() |
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
963 |
revspec = revisionspec.RevisionSpec.from_string('1.1.1') |
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
964 |
rev = revspec.in_history(wt.branch) |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
965 |
self.assertFormatterResult(b"""\ |
|
2997.1.1
by Kent Gibson
Support logging single merge revisions with short and line log formatters. |
966 |
1.1.1: Joe Foo 2005-11-22 rev-merged
|
|
3842.2.7
by Vincent Ladeuil
Fixed as per Jonh's review. |
967 |
""", |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
968 |
wt.branch, log.LineLogFormatter, |
969 |
show_log_kwargs=dict(start_revision=rev, end_revision=rev)) |
|
|
2997.1.1
by Kent Gibson
Support logging single merge revisions with short and line log formatters. |
970 |
|
|
3946.3.2
by Ian Clatworthy
add tests & NEWS item |
971 |
def test_line_log_with_tags(self): |
972 |
wt = self._prepare_tree_with_merges(with_tags=True) |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
973 |
self.assertFormatterResult(b"""\ |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
974 |
3: Joe Foo 2005-11-22 {v1.0, v1.0rc1} rev-3
|
|
3983.2.1
by Neil Martinsen-Burrell
add merge indication to the line format |
975 |
2: Joe Foo 2005-11-22 [merge] {v0.2} rev-2 |
|
3946.3.2
by Ian Clatworthy
add tests & NEWS item |
976 |
1: Joe Foo 2005-11-22 rev-1
|
977 |
""", |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
978 |
wt.branch, log.LineLogFormatter) |
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
979 |
|
980 |
||
981 |
class TestLineLogFormatterWithMergeRevisions(TestCaseForLogFormatter): |
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
982 |
|
983 |
def test_line_merge_revs_log(self): |
|
984 |
"""Line log should show revno |
|
|
4032.1.2
by John Arbash Meinel
Track down a few more files that have trailing whitespace. |
985 |
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
986 |
bug #5162
|
987 |
"""
|
|
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
988 |
wt = self.make_standard_commit('test-line-log', |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
989 |
committer='Line-Log-Formatter Tester <test@line.log>', |
990 |
authors=[]) |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
991 |
self.assertFormatterResult(b"""\ |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
992 |
1: Line-Log-Formatte... 2005-11-22 add a
|
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
993 |
""", |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
994 |
wt.branch, log.LineLogFormatter) |
|
3947.1.2
by Ian Clatworthy
formatter tests |
995 |
|
996 |
def test_line_merge_revs_log_single_merge_revision(self): |
|
|
4955.4.19
by Vincent Ladeuil
Less code duplication. |
997 |
wt = self._prepare_tree_with_merges() |
|
3947.1.2
by Ian Clatworthy
formatter tests |
998 |
revspec = revisionspec.RevisionSpec.from_string('1.1.1') |
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
999 |
rev = revspec.in_history(wt.branch) |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1000 |
self.assertFormatterResult(b"""\ |
|
3947.1.2
by Ian Clatworthy
formatter tests |
1001 |
1.1.1: Joe Foo 2005-11-22 rev-merged
|
1002 |
""", |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1003 |
wt.branch, log.LineLogFormatter, |
1004 |
formatter_kwargs=dict(levels=0), |
|
1005 |
show_log_kwargs=dict(start_revision=rev, end_revision=rev)) |
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
1006 |
|
1007 |
def test_line_merge_revs_log_with_merges(self): |
|
|
4955.4.19
by Vincent Ladeuil
Less code duplication. |
1008 |
wt = self._prepare_tree_with_merges() |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1009 |
self.assertFormatterResult(b"""\ |
|
3983.2.1
by Neil Martinsen-Burrell
add merge indication to the line format |
1010 |
2: Joe Foo 2005-11-22 [merge] rev-2
|
|
3947.1.2
by Ian Clatworthy
formatter tests |
1011 |
1.1.1: Joe Foo 2005-11-22 rev-merged
|
1012 |
1: Joe Foo 2005-11-22 rev-1
|
|
1013 |
""", |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1014 |
wt.branch, log.LineLogFormatter, |
1015 |
formatter_kwargs=dict(levels=0)) |
|
|
4857.4.3
by John Arbash Meinel
Handle LineLogFormatter |
1016 |
|
|
2466.11.2
by Kent Gibson
Add tests for deltas in merge revisions |
1017 |
|
|
4081.2.4
by Martin von Gagern
Added basic test cases for GNU Changelog format. |
1018 |
class TestGnuChangelogFormatter(TestCaseForLogFormatter): |
1019 |
||
1020 |
def test_gnu_changelog(self): |
|
1021 |
wt = self.make_standard_commit('nicky', authors=[]) |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1022 |
self.assertFormatterResult(b'''\ |
|
4081.2.4
by Martin von Gagern
Added basic test cases for GNU Changelog format. |
1023 |
2005-11-22 Lorem Ipsum <test@example.com>
|
1024 |
||
1025 |
\tadd a |
|
1026 |
||
1027 |
''', |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1028 |
wt.branch, log.GnuChangelogLogFormatter) |
|
4081.2.4
by Martin von Gagern
Added basic test cases for GNU Changelog format. |
1029 |
|
1030 |
def test_with_authors(self): |
|
1031 |
wt = self.make_standard_commit('nicky', |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1032 |
authors=['Fooa Fooz <foo@example.com>', |
1033 |
'Bari Baro <bar@example.com>']) |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1034 |
self.assertFormatterResult(b'''\ |
|
4081.2.4
by Martin von Gagern
Added basic test cases for GNU Changelog format. |
1035 |
2005-11-22 Fooa Fooz <foo@example.com>
|
1036 |
||
1037 |
\tadd a |
|
1038 |
||
1039 |
''', |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1040 |
wt.branch, log.GnuChangelogLogFormatter) |
|
4081.2.4
by Martin von Gagern
Added basic test cases for GNU Changelog format. |
1041 |
|
1042 |
def test_verbose(self): |
|
1043 |
wt = self.make_standard_commit('nicky') |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1044 |
self.assertFormatterResult(b'''\ |
|
4081.2.4
by Martin von Gagern
Added basic test cases for GNU Changelog format. |
1045 |
2005-11-22 John Doe <jdoe@example.com>
|
1046 |
||
1047 |
\t* a: |
|
1048 |
||
1049 |
\tadd a |
|
1050 |
||
1051 |
''', |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1052 |
wt.branch, log.GnuChangelogLogFormatter, |
1053 |
show_log_kwargs=dict(verbose=True)) |
|
|
4081.2.4
by Martin von Gagern
Added basic test cases for GNU Changelog format. |
1054 |
|
|
1551.17.2
by Aaron Bentley
Stop showing deltas in pull -v output |
1055 |
|
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
1056 |
class TestShowChangedRevisions(tests.TestCaseWithTransport): |
|
1551.17.2
by Aaron Bentley
Stop showing deltas in pull -v output |
1057 |
|
1058 |
def test_show_changed_revisions_verbose(self): |
|
1059 |
tree = self.make_branch_and_tree('tree_a') |
|
1060 |
self.build_tree(['tree_a/foo']) |
|
1061 |
tree.add('foo') |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1062 |
tree.commit('bar', rev_id=b'bar-id') |
|
2717.1.1
by Lukáš Lalinsky
Use UTF-8 encoded StringIO for log tests to avoid failures on non-ASCII committer names. |
1063 |
s = self.make_utf8_encoded_stringio() |
|
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
1064 |
log.show_changed_revisions(tree.branch, [], [b'bar-id'], s) |
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1065 |
self.assertContainsRe(s.getvalue(), b'bar') |
1066 |
self.assertNotContainsRe(s.getvalue(), b'foo') |
|
|
2671.5.8
by Lukáš Lalinsky
Add tests for LogFormatter.short_committer and LogFormatter.short_author. |
1067 |
|
1068 |
||
|
3842.2.1
by Vincent Ladeuil
Cosmetic changes. |
1069 |
class TestLogFormatter(tests.TestCase): |
|
2671.5.8
by Lukáš Lalinsky
Add tests for LogFormatter.short_committer and LogFormatter.short_author. |
1070 |
|
|
4955.4.15
by Vincent Ladeuil
Remove duplicated code. |
1071 |
def setUp(self): |
1072 |
super(TestLogFormatter, self).setUp() |
|
|
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
1073 |
self.rev = revision.Revision(b'a-id') |
|
4955.4.15
by Vincent Ladeuil
Remove duplicated code. |
1074 |
self.lf = log.LogFormatter(None) |
1075 |
||
|
2671.5.8
by Lukáš Lalinsky
Add tests for LogFormatter.short_committer and LogFormatter.short_author. |
1076 |
def test_short_committer(self): |
|
4955.4.15
by Vincent Ladeuil
Remove duplicated code. |
1077 |
def assertCommitter(expected, committer): |
1078 |
self.rev.committer = committer |
|
1079 |
self.assertEqual(expected, self.lf.short_committer(self.rev)) |
|
1080 |
||
1081 |
assertCommitter('John Doe', 'John Doe <jdoe@example.com>') |
|
1082 |
assertCommitter('John Smith', 'John Smith <jsmith@example.com>') |
|
1083 |
assertCommitter('John Smith', 'John Smith') |
|
1084 |
assertCommitter('jsmith@example.com', 'jsmith@example.com') |
|
1085 |
assertCommitter('jsmith@example.com', '<jsmith@example.com>') |
|
1086 |
assertCommitter('John Smith', 'John Smith jsmith@example.com') |
|
|
2671.5.8
by Lukáš Lalinsky
Add tests for LogFormatter.short_committer and LogFormatter.short_author. |
1087 |
|
1088 |
def test_short_author(self): |
|
|
4955.4.15
by Vincent Ladeuil
Remove duplicated code. |
1089 |
def assertAuthor(expected, author): |
1090 |
self.rev.properties['author'] = author |
|
1091 |
self.assertEqual(expected, self.lf.short_author(self.rev)) |
|
1092 |
||
1093 |
assertAuthor('John Smith', 'John Smith <jsmith@example.com>') |
|
1094 |
assertAuthor('John Smith', 'John Smith') |
|
1095 |
assertAuthor('jsmith@example.com', 'jsmith@example.com') |
|
1096 |
assertAuthor('jsmith@example.com', '<jsmith@example.com>') |
|
1097 |
assertAuthor('John Smith', 'John Smith jsmith@example.com') |
|
1098 |
||
1099 |
def test_short_author_from_committer(self): |
|
1100 |
self.rev.committer = 'John Doe <jdoe@example.com>' |
|
1101 |
self.assertEqual('John Doe', self.lf.short_author(self.rev)) |
|
1102 |
||
1103 |
def test_short_author_from_authors(self): |
|
1104 |
self.rev.properties['authors'] = ('John Smith <jsmith@example.com>\n' |
|
1105 |
'Jane Rey <jrey@example.com>') |
|
1106 |
self.assertEqual('John Smith', self.lf.short_author(self.rev)) |
|
|
3842.2.2
by Vincent Ladeuil
Reproduce bug #300055. |
1107 |
|
1108 |
||
1109 |
class TestReverseByDepth(tests.TestCase): |
|
1110 |
"""Test reverse_by_depth behavior. |
|
1111 |
||
1112 |
This is used to present revisions in forward (oldest first) order in a nice
|
|
1113 |
layout.
|
|
1114 |
||
1115 |
The tests use lighter revision description to ease reading.
|
|
1116 |
"""
|
|
1117 |
||
1118 |
def assertReversed(self, forward, backward): |
|
1119 |
# Transform the descriptions to suit the API: tests use (revno, depth),
|
|
1120 |
# while the API expects (revid, revno, depth)
|
|
1121 |
def complete_revisions(l): |
|
1122 |
"""Transform the description to suit the API. |
|
1123 |
||
1124 |
Tests use (revno, depth) whil the API expects (revid, revno, depth).
|
|
1125 |
Since the revid is arbitrary, we just duplicate revno
|
|
1126 |
"""
|
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1127 |
return [(r, r, d) for r, d in l] |
|
3842.2.2
by Vincent Ladeuil
Reproduce bug #300055. |
1128 |
forward = complete_revisions(forward) |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1129 |
backward = complete_revisions(backward) |
|
3842.2.2
by Vincent Ladeuil
Reproduce bug #300055. |
1130 |
self.assertEqual(forward, log.reverse_by_depth(backward)) |
1131 |
||
1132 |
def test_mainline_revisions(self): |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1133 |
self.assertReversed([('1', 0), ('2', 0)], |
|
3842.2.2
by Vincent Ladeuil
Reproduce bug #300055. |
1134 |
[('2', 0), ('1', 0)]) |
1135 |
||
1136 |
def test_merged_revisions(self): |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1137 |
self.assertReversed([('1', 0), ('2', 0), ('2.2', 1), ('2.1', 1), ], |
1138 |
[('2', 0), ('2.1', 1), ('2.2', 1), ('1', 0), ]) |
|
1139 |
||
|
3842.2.2
by Vincent Ladeuil
Reproduce bug #300055. |
1140 |
def test_shifted_merged_revisions(self): |
1141 |
"""Test irregular layout. |
|
1142 |
||
1143 |
Requesting revisions touching a file can produce "holes" in the depths.
|
|
1144 |
"""
|
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1145 |
self.assertReversed([('1', 0), ('2', 0), ('1.1', 2), ('1.2', 2), ], |
1146 |
[('2', 0), ('1.2', 2), ('1.1', 2), ('1', 0), ]) |
|
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
1147 |
|
1148 |
def test_merged_without_child_revisions(self): |
|
1149 |
"""Test irregular layout. |
|
1150 |
||
1151 |
Revision ranges can produce "holes" in the depths.
|
|
1152 |
"""
|
|
1153 |
# When a revision of higher depth doesn't follow one of lower depth, we
|
|
1154 |
# assume a lower depth one is virtually there
|
|
1155 |
self.assertReversed([('1', 2), ('2', 2), ('3', 3), ('4', 4)], |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1156 |
[('4', 4), ('3', 3), ('2', 2), ('1', 2), ]) |
|
3842.2.3
by Vincent Ladeuil
Yet more cleanup and fix test_file_id_f3 bogus test. |
1157 |
# So we get the same order after reversing below even if the original
|
1158 |
# revisions are not in the same order.
|
|
1159 |
self.assertReversed([('1', 2), ('2', 2), ('3', 3), ('4', 4)], |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1160 |
[('3', 3), ('4', 4), ('2', 2), ('1', 2), ]) |
|
3848.1.6
by Aaron Bentley
Implement get_history_change |
1161 |
|
1162 |
||
|
3848.1.8
by Aaron Bentley
Implement basic show_branch_change |
1163 |
class TestHistoryChange(tests.TestCaseWithTransport): |
|
3848.1.6
by Aaron Bentley
Implement get_history_change |
1164 |
|
1165 |
def setup_a_tree(self): |
|
1166 |
tree = self.make_branch_and_tree('tree') |
|
1167 |
tree.lock_write() |
|
1168 |
self.addCleanup(tree.unlock) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1169 |
tree.commit('1a', rev_id=b'1a') |
1170 |
tree.commit('2a', rev_id=b'2a') |
|
1171 |
tree.commit('3a', rev_id=b'3a') |
|
|
3848.1.6
by Aaron Bentley
Implement get_history_change |
1172 |
return tree |
1173 |
||
1174 |
def setup_ab_tree(self): |
|
1175 |
tree = self.setup_a_tree() |
|
|
6973.10.6
by Jelmer Vernooij
Fix tests. |
1176 |
tree.set_last_revision(b'1a') |
1177 |
tree.branch.set_last_revision_info(1, b'1a') |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1178 |
tree.commit('2b', rev_id=b'2b') |
1179 |
tree.commit('3b', rev_id=b'3b') |
|
|
3848.1.6
by Aaron Bentley
Implement get_history_change |
1180 |
return tree |
1181 |
||
1182 |
def setup_ac_tree(self): |
|
1183 |
tree = self.setup_a_tree() |
|
1184 |
tree.set_last_revision(revision.NULL_REVISION) |
|
1185 |
tree.branch.set_last_revision_info(0, revision.NULL_REVISION) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1186 |
tree.commit('1c', rev_id=b'1c') |
1187 |
tree.commit('2c', rev_id=b'2c') |
|
1188 |
tree.commit('3c', rev_id=b'3c') |
|
|
3848.1.6
by Aaron Bentley
Implement get_history_change |
1189 |
return tree |
1190 |
||
1191 |
def test_all_new(self): |
|
1192 |
tree = self.setup_ab_tree() |
|
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1193 |
old, new = log.get_history_change(b'1a', b'3a', tree.branch.repository) |
|
3848.1.6
by Aaron Bentley
Implement get_history_change |
1194 |
self.assertEqual([], old) |
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1195 |
self.assertEqual([b'2a', b'3a'], new) |
|
3848.1.6
by Aaron Bentley
Implement get_history_change |
1196 |
|
1197 |
def test_all_old(self): |
|
1198 |
tree = self.setup_ab_tree() |
|
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1199 |
old, new = log.get_history_change(b'3a', b'1a', tree.branch.repository) |
|
3848.1.6
by Aaron Bentley
Implement get_history_change |
1200 |
self.assertEqual([], new) |
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1201 |
self.assertEqual([b'2a', b'3a'], old) |
|
3848.1.6
by Aaron Bentley
Implement get_history_change |
1202 |
|
1203 |
def test_null_old(self): |
|
1204 |
tree = self.setup_ab_tree() |
|
1205 |
old, new = log.get_history_change(revision.NULL_REVISION, |
|
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1206 |
b'3a', tree.branch.repository) |
|
3848.1.6
by Aaron Bentley
Implement get_history_change |
1207 |
self.assertEqual([], old) |
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1208 |
self.assertEqual([b'1a', b'2a', b'3a'], new) |
|
3848.1.6
by Aaron Bentley
Implement get_history_change |
1209 |
|
1210 |
def test_null_new(self): |
|
1211 |
tree = self.setup_ab_tree() |
|
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1212 |
old, new = log.get_history_change(b'3a', revision.NULL_REVISION, |
|
3848.1.7
by Aaron Bentley
Use repository in get_history_change |
1213 |
tree.branch.repository) |
|
3848.1.6
by Aaron Bentley
Implement get_history_change |
1214 |
self.assertEqual([], new) |
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1215 |
self.assertEqual([b'1a', b'2a', b'3a'], old) |
|
3848.1.6
by Aaron Bentley
Implement get_history_change |
1216 |
|
1217 |
def test_diverged(self): |
|
1218 |
tree = self.setup_ab_tree() |
|
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1219 |
old, new = log.get_history_change(b'3a', b'3b', tree.branch.repository) |
1220 |
self.assertEqual(old, [b'2a', b'3a']) |
|
1221 |
self.assertEqual(new, [b'2b', b'3b']) |
|
|
3848.1.6
by Aaron Bentley
Implement get_history_change |
1222 |
|
1223 |
def test_unrelated(self): |
|
1224 |
tree = self.setup_ac_tree() |
|
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1225 |
old, new = log.get_history_change(b'3a', b'3c', tree.branch.repository) |
1226 |
self.assertEqual(old, [b'1a', b'2a', b'3a']) |
|
1227 |
self.assertEqual(new, [b'1c', b'2c', b'3c']) |
|
|
3848.1.8
by Aaron Bentley
Implement basic show_branch_change |
1228 |
|
1229 |
def test_show_branch_change(self): |
|
1230 |
tree = self.setup_ab_tree() |
|
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1231 |
s = StringIO() |
1232 |
log.show_branch_change(tree.branch, s, 3, b'3a') |
|
|
3848.1.8
by Aaron Bentley
Implement basic show_branch_change |
1233 |
self.assertContainsRe(s.getvalue(), |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1234 |
'[*]{60}\nRemoved Revisions:\n(.|\n)*2a(.|\n)*3a(.|\n)*' |
1235 |
'[*]{60}\n\nAdded Revisions:\n(.|\n)*2b(.|\n)*3b') |
|
|
3848.1.8
by Aaron Bentley
Implement basic show_branch_change |
1236 |
|
1237 |
def test_show_branch_change_no_change(self): |
|
1238 |
tree = self.setup_ab_tree() |
|
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1239 |
s = StringIO() |
1240 |
log.show_branch_change(tree.branch, s, 3, b'3b') |
|
|
3848.1.8
by Aaron Bentley
Implement basic show_branch_change |
1241 |
self.assertEqual(s.getvalue(), |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1242 |
'Nothing seems to have changed\n') |
|
3848.1.8
by Aaron Bentley
Implement basic show_branch_change |
1243 |
|
|
3848.1.9
by Aaron Bentley
new/old sections are omitted as appropriate. |
1244 |
def test_show_branch_change_no_old(self): |
1245 |
tree = self.setup_ab_tree() |
|
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1246 |
s = StringIO() |
1247 |
log.show_branch_change(tree.branch, s, 2, b'2b') |
|
|
3848.1.9
by Aaron Bentley
new/old sections are omitted as appropriate. |
1248 |
self.assertContainsRe(s.getvalue(), 'Added Revisions:') |
1249 |
self.assertNotContainsRe(s.getvalue(), 'Removed Revisions:') |
|
1250 |
||
1251 |
def test_show_branch_change_no_new(self): |
|
1252 |
tree = self.setup_ab_tree() |
|
|
6973.10.6
by Jelmer Vernooij
Fix tests. |
1253 |
tree.branch.set_last_revision_info(2, b'2b') |
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1254 |
s = StringIO() |
1255 |
log.show_branch_change(tree.branch, s, 3, b'3b') |
|
|
3848.1.9
by Aaron Bentley
new/old sections are omitted as appropriate. |
1256 |
self.assertContainsRe(s.getvalue(), 'Removed Revisions:') |
1257 |
self.assertNotContainsRe(s.getvalue(), 'Added Revisions:') |
|
|
4921.2.1
by Neil Martinsen-Burrell
include bug fixes in log output |
1258 |
|
|
5728.5.2
by Matt Giuca
test_log: Split new test cases for this branch out into a separate class, |
1259 |
|
|
5728.5.4
by Matt Giuca
test_log: TestRevisionNotInBranch: Added three new test cases, testing the |
1260 |
class TestRevisionNotInBranch(TestCaseForLogFormatter): |
|
5728.5.2
by Matt Giuca
test_log: Split new test cases for this branch out into a separate class, |
1261 |
|
1262 |
def setup_a_tree(self): |
|
1263 |
tree = self.make_branch_and_tree('tree') |
|
1264 |
tree.lock_write() |
|
1265 |
self.addCleanup(tree.unlock) |
|
|
5728.5.3
by Matt Giuca
test_log: TestRevisionNotInBranch commits now have more metadata. |
1266 |
kwargs = { |
1267 |
'committer': 'Joe Foo <joe@foo.com>', |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1268 |
'timestamp': 1132617600, # Mon 2005-11-22 00:00:00 +0000 |
1269 |
'timezone': 0, # UTC |
|
|
5728.5.3
by Matt Giuca
test_log: TestRevisionNotInBranch commits now have more metadata. |
1270 |
}
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1271 |
tree.commit('commit 1a', rev_id=b'1a', **kwargs) |
1272 |
tree.commit('commit 2a', rev_id=b'2a', **kwargs) |
|
1273 |
tree.commit('commit 3a', rev_id=b'3a', **kwargs) |
|
|
5728.5.2
by Matt Giuca
test_log: Split new test cases for this branch out into a separate class, |
1274 |
return tree |
1275 |
||
1276 |
def setup_ab_tree(self): |
|
1277 |
tree = self.setup_a_tree() |
|
|
6973.10.6
by Jelmer Vernooij
Fix tests. |
1278 |
tree.set_last_revision(b'1a') |
1279 |
tree.branch.set_last_revision_info(1, b'1a') |
|
|
5728.5.3
by Matt Giuca
test_log: TestRevisionNotInBranch commits now have more metadata. |
1280 |
kwargs = { |
1281 |
'committer': 'Joe Foo <joe@foo.com>', |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1282 |
'timestamp': 1132617600, # Mon 2005-11-22 00:00:00 +0000 |
1283 |
'timezone': 0, # UTC |
|
|
5728.5.3
by Matt Giuca
test_log: TestRevisionNotInBranch commits now have more metadata. |
1284 |
}
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1285 |
tree.commit('commit 2b', rev_id=b'2b', **kwargs) |
1286 |
tree.commit('commit 3b', rev_id=b'3b', **kwargs) |
|
|
5728.5.2
by Matt Giuca
test_log: Split new test cases for this branch out into a separate class, |
1287 |
return tree |
1288 |
||
1289 |
def test_one_revision(self): |
|
|
5728.5.1
by Matt Giuca
log no longer raises NoSuchRevision against revisions in the |
1290 |
tree = self.setup_ab_tree() |
1291 |
lf = LogCatcher() |
|
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1292 |
rev = revisionspec.RevisionInfo(tree.branch, None, b'3a') |
|
5728.5.1
by Matt Giuca
log no longer raises NoSuchRevision against revisions in the |
1293 |
log.show_log(tree.branch, lf, verbose=True, start_revision=rev, |
1294 |
end_revision=rev) |
|
1295 |
self.assertEqual(1, len(lf.revisions)) |
|
|
5728.5.5
by Matt Giuca
log: If a revision is not in the branch, it now sets its revno to None |
1296 |
self.assertEqual(None, lf.revisions[0].revno) # Out-of-branch |
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1297 |
self.assertEqual(b'3a', lf.revisions[0].rev.revision_id) |
|
5728.5.1
by Matt Giuca
log no longer raises NoSuchRevision against revisions in the |
1298 |
|
|
5728.5.2
by Matt Giuca
test_log: Split new test cases for this branch out into a separate class, |
1299 |
def test_many_revisions(self): |
|
5728.5.1
by Matt Giuca
log no longer raises NoSuchRevision against revisions in the |
1300 |
tree = self.setup_ab_tree() |
1301 |
lf = LogCatcher() |
|
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1302 |
start_rev = revisionspec.RevisionInfo(tree.branch, None, b'1a') |
1303 |
end_rev = revisionspec.RevisionInfo(tree.branch, None, b'3a') |
|
|
5728.5.1
by Matt Giuca
log no longer raises NoSuchRevision against revisions in the |
1304 |
log.show_log(tree.branch, lf, verbose=True, start_revision=start_rev, |
1305 |
end_revision=end_rev) |
|
1306 |
self.assertEqual(3, len(lf.revisions)) |
|
|
5728.5.5
by Matt Giuca
log: If a revision is not in the branch, it now sets its revno to None |
1307 |
self.assertEqual(None, lf.revisions[0].revno) # Out-of-branch |
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1308 |
self.assertEqual(b'3a', lf.revisions[0].rev.revision_id) |
|
5728.5.5
by Matt Giuca
log: If a revision is not in the branch, it now sets its revno to None |
1309 |
self.assertEqual(None, lf.revisions[1].revno) # Out-of-branch |
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1310 |
self.assertEqual(b'2a', lf.revisions[1].rev.revision_id) |
|
5728.5.1
by Matt Giuca
log no longer raises NoSuchRevision against revisions in the |
1311 |
self.assertEqual('1', lf.revisions[2].revno) # In-branch |
|
4921.2.1
by Neil Martinsen-Burrell
include bug fixes in log output |
1312 |
|
|
5728.5.4
by Matt Giuca
test_log: TestRevisionNotInBranch: Added three new test cases, testing the |
1313 |
def test_long_format(self): |
1314 |
tree = self.setup_ab_tree() |
|
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1315 |
start_rev = revisionspec.RevisionInfo(tree.branch, None, b'1a') |
1316 |
end_rev = revisionspec.RevisionInfo(tree.branch, None, b'3a') |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1317 |
self.assertFormatterResult(b"""\ |
|
5728.5.4
by Matt Giuca
test_log: TestRevisionNotInBranch: Added three new test cases, testing the |
1318 |
------------------------------------------------------------
|
|
5728.5.6
by Matt Giuca
log: 'long' and 'short' log formats now always show the revision-id for any |
1319 |
revision-id: 3a
|
|
5728.5.4
by Matt Giuca
test_log: TestRevisionNotInBranch: Added three new test cases, testing the |
1320 |
committer: Joe Foo <joe@foo.com>
|
1321 |
branch nick: tree
|
|
|
5728.5.10
by Andrew Bennetts
Use UTC, not system time zone, for the new log tests to get predictable output. |
1322 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
5728.5.4
by Matt Giuca
test_log: TestRevisionNotInBranch: Added three new test cases, testing the |
1323 |
message:
|
1324 |
commit 3a
|
|
1325 |
------------------------------------------------------------
|
|
|
5728.5.6
by Matt Giuca
log: 'long' and 'short' log formats now always show the revision-id for any |
1326 |
revision-id: 2a
|
|
5728.5.4
by Matt Giuca
test_log: TestRevisionNotInBranch: Added three new test cases, testing the |
1327 |
committer: Joe Foo <joe@foo.com>
|
1328 |
branch nick: tree
|
|
|
5728.5.10
by Andrew Bennetts
Use UTC, not system time zone, for the new log tests to get predictable output. |
1329 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
5728.5.4
by Matt Giuca
test_log: TestRevisionNotInBranch: Added three new test cases, testing the |
1330 |
message:
|
1331 |
commit 2a
|
|
1332 |
------------------------------------------------------------
|
|
1333 |
revno: 1
|
|
1334 |
committer: Joe Foo <joe@foo.com>
|
|
1335 |
branch nick: tree
|
|
|
5728.5.10
by Andrew Bennetts
Use UTC, not system time zone, for the new log tests to get predictable output. |
1336 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
5728.5.4
by Matt Giuca
test_log: TestRevisionNotInBranch: Added three new test cases, testing the |
1337 |
message:
|
1338 |
commit 1a
|
|
1339 |
""", |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1340 |
tree.branch, log.LongLogFormatter, show_log_kwargs={ |
1341 |
'start_revision': start_rev, 'end_revision': end_rev |
|
1342 |
})
|
|
|
5728.5.4
by Matt Giuca
test_log: TestRevisionNotInBranch: Added three new test cases, testing the |
1343 |
|
1344 |
def test_short_format(self): |
|
1345 |
tree = self.setup_ab_tree() |
|
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1346 |
start_rev = revisionspec.RevisionInfo(tree.branch, None, b'1a') |
1347 |
end_rev = revisionspec.RevisionInfo(tree.branch, None, b'3a') |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1348 |
self.assertFormatterResult(b"""\ |
|
5728.5.5
by Matt Giuca
log: If a revision is not in the branch, it now sets its revno to None |
1349 |
Joe Foo\t2005-11-22 |
|
5728.5.6
by Matt Giuca
log: 'long' and 'short' log formats now always show the revision-id for any |
1350 |
revision-id:3a
|
|
5728.5.4
by Matt Giuca
test_log: TestRevisionNotInBranch: Added three new test cases, testing the |
1351 |
commit 3a
|
1352 |
||
|
5728.5.5
by Matt Giuca
log: If a revision is not in the branch, it now sets its revno to None |
1353 |
Joe Foo\t2005-11-22 |
|
5728.5.6
by Matt Giuca
log: 'long' and 'short' log formats now always show the revision-id for any |
1354 |
revision-id:2a
|
|
5728.5.4
by Matt Giuca
test_log: TestRevisionNotInBranch: Added three new test cases, testing the |
1355 |
commit 2a
|
1356 |
||
1357 |
1 Joe Foo\t2005-11-22 |
|
1358 |
commit 1a
|
|
1359 |
||
1360 |
""", |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1361 |
tree.branch, log.ShortLogFormatter, show_log_kwargs={ |
1362 |
'start_revision': start_rev, 'end_revision': end_rev |
|
1363 |
})
|
|
|
5728.5.4
by Matt Giuca
test_log: TestRevisionNotInBranch: Added three new test cases, testing the |
1364 |
|
1365 |
def test_line_format(self): |
|
1366 |
tree = self.setup_ab_tree() |
|
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1367 |
start_rev = revisionspec.RevisionInfo(tree.branch, None, b'1a') |
1368 |
end_rev = revisionspec.RevisionInfo(tree.branch, None, b'3a') |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1369 |
self.assertFormatterResult(b"""\ |
|
5728.5.5
by Matt Giuca
log: If a revision is not in the branch, it now sets its revno to None |
1370 |
Joe Foo 2005-11-22 commit 3a
|
1371 |
Joe Foo 2005-11-22 commit 2a
|
|
|
5728.5.4
by Matt Giuca
test_log: TestRevisionNotInBranch: Added three new test cases, testing the |
1372 |
1: Joe Foo 2005-11-22 commit 1a
|
1373 |
""", |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1374 |
tree.branch, log.LineLogFormatter, show_log_kwargs={ |
1375 |
'start_revision': start_rev, 'end_revision': end_rev |
|
1376 |
})
|
|
|
5728.5.4
by Matt Giuca
test_log: TestRevisionNotInBranch: Added three new test cases, testing the |
1377 |
|
|
4921.2.1
by Neil Martinsen-Burrell
include bug fixes in log output |
1378 |
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
1379 |
class TestLogWithBugs(TestCaseForLogFormatter, TestLogMixin): |
|
4921.2.1
by Neil Martinsen-Burrell
include bug fixes in log output |
1380 |
|
1381 |
def setUp(self): |
|
|
6552.1.4
by Vincent Ladeuil
Remaining tests matching setup(self) that can be rewritten with super(). |
1382 |
super(TestLogWithBugs, self).setUp() |
|
4921.2.1
by Neil Martinsen-Burrell
include bug fixes in log output |
1383 |
log.properties_handler_registry.register( |
1384 |
'bugs_properties_handler', |
|
1385 |
log._bugs_properties_handler) |
|
1386 |
||
|
4921.2.2
by Neil Martinsen-Burrell
from review comments: improve splitting, add test that handler is present, use build_tree in tests |
1387 |
def make_commits_with_bugs(self): |
1388 |
"""Helper method for LogFormatter tests""" |
|
1389 |
tree = self.make_branch_and_tree(u'.') |
|
1390 |
self.build_tree(['a', 'b']) |
|
1391 |
tree.add('a') |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1392 |
self.wt_commit(tree, 'simple log message', rev_id=b'a1', |
|
6973.12.5
by Jelmer Vernooij
Add some u's for revision property names. |
1393 |
revprops={u'bugs': 'test://bug/id fixed'}) |
|
4921.2.2
by Neil Martinsen-Burrell
from review comments: improve splitting, add test that handler is present, use build_tree in tests |
1394 |
tree.add('b') |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1395 |
self.wt_commit(tree, 'multiline\nlog\nmessage\n', rev_id=b'a2', |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
1396 |
authors=['Joe Bar <joe@bar.com>'], |
|
6973.12.5
by Jelmer Vernooij
Add some u's for revision property names. |
1397 |
revprops={u'bugs': 'test://bug/id fixed\n' |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
1398 |
'test://bug/2 fixed'}) |
|
4921.2.2
by Neil Martinsen-Burrell
from review comments: improve splitting, add test that handler is present, use build_tree in tests |
1399 |
return tree |
1400 |
||
|
7182.1.4
by Jelmer Vernooij
Print exceptions when custom handlers raise exceptions rather than aborting. |
1401 |
def test_bug_broken(self): |
1402 |
tree = self.make_branch_and_tree(u'.') |
|
1403 |
self.build_tree(['a', 'b']) |
|
1404 |
tree.add('a') |
|
1405 |
self.wt_commit(tree, 'simple log message', rev_id=b'a1', |
|
1406 |
revprops={u'bugs': 'test://bua g/id fixed'}) |
|
1407 |
||
1408 |
logfile = self.make_utf8_encoded_stringio() |
|
1409 |
formatter = log.LongLogFormatter(to_file=logfile) |
|
1410 |
log.show_log(tree.branch, formatter) |
|
1411 |
||
1412 |
self.assertContainsRe( |
|
1413 |
logfile.getvalue(), |
|
|
7182.1.6
by Jelmer Vernooij
More beees. |
1414 |
b'brz: ERROR: breezy.bugtracker.InvalidLineInBugsProperty: ' |
1415 |
b'Invalid line in bugs property: \'test://bua g/id fixed\'') |
|
|
7182.1.4
by Jelmer Vernooij
Print exceptions when custom handlers raise exceptions rather than aborting. |
1416 |
|
1417 |
text = logfile.getvalue() |
|
1418 |
self.assertEqualDiff( |
|
|
7182.1.6
by Jelmer Vernooij
More beees. |
1419 |
text[text.index(b'-' * 60):], |
1420 |
b"""\ |
|
|
7182.1.4
by Jelmer Vernooij
Print exceptions when custom handlers raise exceptions rather than aborting. |
1421 |
------------------------------------------------------------
|
1422 |
revno: 1
|
|
1423 |
committer: Joe Foo <joe@foo.com>
|
|
1424 |
branch nick: work
|
|
1425 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
1426 |
message:
|
|
1427 |
simple log message
|
|
1428 |
""") |
|
1429 |
||
|
4921.2.1
by Neil Martinsen-Burrell
include bug fixes in log output |
1430 |
def test_long_bugs(self): |
|
4921.2.2
by Neil Martinsen-Burrell
from review comments: improve splitting, add test that handler is present, use build_tree in tests |
1431 |
tree = self.make_commits_with_bugs() |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1432 |
self.assertFormatterResult(b"""\ |
|
4921.2.1
by Neil Martinsen-Burrell
include bug fixes in log output |
1433 |
------------------------------------------------------------
|
1434 |
revno: 2
|
|
|
6143.1.8
by Jonathan Riddell
fix log formatting of bug line |
1435 |
fixes bugs: test://bug/id test://bug/2
|
|
4921.2.1
by Neil Martinsen-Burrell
include bug fixes in log output |
1436 |
author: Joe Bar <joe@bar.com>
|
1437 |
committer: Joe Foo <joe@foo.com>
|
|
1438 |
branch nick: work
|
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
1439 |
timestamp: Tue 2005-11-22 00:00:01 +0000
|
|
4921.2.1
by Neil Martinsen-Burrell
include bug fixes in log output |
1440 |
message:
|
1441 |
multiline
|
|
1442 |
log
|
|
1443 |
message
|
|
1444 |
------------------------------------------------------------
|
|
1445 |
revno: 1
|
|
|
6143.1.4
by Jonathan Riddell
update tests |
1446 |
fixes bug: test://bug/id
|
|
4921.2.1
by Neil Martinsen-Burrell
include bug fixes in log output |
1447 |
committer: Joe Foo <joe@foo.com>
|
1448 |
branch nick: work
|
|
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
1449 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
4921.2.1
by Neil Martinsen-Burrell
include bug fixes in log output |
1450 |
message:
|
1451 |
simple log message
|
|
1452 |
""", |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1453 |
tree.branch, log.LongLogFormatter) |
|
4921.2.1
by Neil Martinsen-Burrell
include bug fixes in log output |
1454 |
|
1455 |
def test_short_bugs(self): |
|
|
4921.2.2
by Neil Martinsen-Burrell
from review comments: improve splitting, add test that handler is present, use build_tree in tests |
1456 |
tree = self.make_commits_with_bugs() |
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1457 |
self.assertFormatterResult(b"""\ |
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
1458 |
2 Joe Bar\t2005-11-22 |
|
6143.1.4
by Jonathan Riddell
update tests |
1459 |
fixes bugs: test://bug/id test://bug/2
|
|
4921.2.1
by Neil Martinsen-Burrell
include bug fixes in log output |
1460 |
multiline
|
1461 |
log
|
|
1462 |
message
|
|
1463 |
||
|
4955.4.17
by Vincent Ladeuil
Use a data factory for commit properties and reduce code duplication. |
1464 |
1 Joe Foo\t2005-11-22 |
|
6143.1.4
by Jonathan Riddell
update tests |
1465 |
fixes bug: test://bug/id
|
|
4921.2.1
by Neil Martinsen-Burrell
include bug fixes in log output |
1466 |
simple log message
|
1467 |
||
1468 |
""", |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1469 |
tree.branch, log.ShortLogFormatter) |
|
4921.2.1
by Neil Martinsen-Burrell
include bug fixes in log output |
1470 |
|
1471 |
def test_wrong_bugs_property(self): |
|
1472 |
tree = self.make_branch_and_tree(u'.') |
|
1473 |
self.build_tree(['foo']) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1474 |
self.wt_commit(tree, 'simple log message', rev_id=b'a1', |
|
6973.12.5
by Jelmer Vernooij
Add some u's for revision property names. |
1475 |
revprops={u'bugs': 'test://bug/id invalid_value'}) |
|
7182.1.4
by Jelmer Vernooij
Print exceptions when custom handlers raise exceptions rather than aborting. |
1476 |
|
1477 |
logfile = self.make_utf8_encoded_stringio() |
|
1478 |
formatter = log.ShortLogFormatter(to_file=logfile) |
|
1479 |
log.show_log(tree.branch, formatter) |
|
1480 |
||
1481 |
lines = logfile.getvalue().splitlines() |
|
1482 |
||
1483 |
self.assertEqual( |
|
|
7182.1.6
by Jelmer Vernooij
More beees. |
1484 |
lines[0], b' 1 Joe Foo\t2005-11-22') |
|
7182.1.4
by Jelmer Vernooij
Print exceptions when custom handlers raise exceptions rather than aborting. |
1485 |
|
1486 |
self.assertEqual( |
|
1487 |
lines[1], |
|
|
7182.1.6
by Jelmer Vernooij
More beees. |
1488 |
b'brz: ERROR: breezy.bugtracker.InvalidBugStatus: Invalid ' |
1489 |
b'bug status: \'invalid_value\'') |
|
|
7182.1.4
by Jelmer Vernooij
Print exceptions when custom handlers raise exceptions rather than aborting. |
1490 |
|
|
7182.1.6
by Jelmer Vernooij
More beees. |
1491 |
self.assertEqual(lines[-2], b" simple log message") |
|
4921.2.2
by Neil Martinsen-Burrell
from review comments: improve splitting, add test that handler is present, use build_tree in tests |
1492 |
|
1493 |
def test_bugs_handler_present(self): |
|
1494 |
self.properties_handler_registry.get('bugs_properties_handler') |
|
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1495 |
|
1496 |
||
1497 |
class TestLogForAuthors(TestCaseForLogFormatter): |
|
1498 |
||
1499 |
def setUp(self): |
|
|
6552.1.4
by Vincent Ladeuil
Remaining tests matching setup(self) that can be rewritten with super(). |
1500 |
super(TestLogForAuthors, self).setUp() |
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1501 |
self.wt = self.make_standard_commit('nicky', |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1502 |
authors=['John Doe <jdoe@example.com>', |
1503 |
'Jane Rey <jrey@example.com>']) |
|
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1504 |
|
1505 |
def assertFormatterResult(self, formatter, who, result): |
|
1506 |
formatter_kwargs = dict() |
|
1507 |
if who is not None: |
|
|
4081.3.10
by Martin von Gagern
Renamed "authors" to "author_list_handler" in several places. |
1508 |
author_list_handler = log.author_list_registry.get(who) |
1509 |
formatter_kwargs['author_list_handler'] = author_list_handler |
|
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1510 |
TestCaseForLogFormatter.assertFormatterResult(self, result, |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1511 |
self.wt.branch, formatter, formatter_kwargs=formatter_kwargs) |
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1512 |
|
1513 |
def test_line_default(self): |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1514 |
self.assertFormatterResult(log.LineLogFormatter, None, b"""\ |
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1515 |
1: John Doe 2005-11-22 add a
|
1516 |
""") |
|
1517 |
||
1518 |
def test_line_committer(self): |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1519 |
self.assertFormatterResult(log.LineLogFormatter, 'committer', b"""\ |
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1520 |
1: Lorem Ipsum 2005-11-22 add a
|
1521 |
""") |
|
1522 |
||
1523 |
def test_line_first(self): |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1524 |
self.assertFormatterResult(log.LineLogFormatter, 'first', b"""\ |
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1525 |
1: John Doe 2005-11-22 add a
|
1526 |
""") |
|
1527 |
||
1528 |
def test_line_all(self): |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1529 |
self.assertFormatterResult(log.LineLogFormatter, 'all', b"""\ |
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1530 |
1: John Doe, Jane Rey 2005-11-22 add a
|
1531 |
""") |
|
1532 |
||
1533 |
def test_short_default(self): |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1534 |
self.assertFormatterResult(log.ShortLogFormatter, None, b"""\ |
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1535 |
1 John Doe\t2005-11-22 |
1536 |
add a
|
|
1537 |
||
1538 |
""") |
|
1539 |
||
1540 |
def test_short_committer(self): |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1541 |
self.assertFormatterResult(log.ShortLogFormatter, 'committer', b"""\ |
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1542 |
1 Lorem Ipsum\t2005-11-22 |
1543 |
add a
|
|
1544 |
||
1545 |
""") |
|
1546 |
||
1547 |
def test_short_first(self): |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1548 |
self.assertFormatterResult(log.ShortLogFormatter, 'first', b"""\ |
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1549 |
1 John Doe\t2005-11-22 |
1550 |
add a
|
|
1551 |
||
1552 |
""") |
|
1553 |
||
1554 |
def test_short_all(self): |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1555 |
self.assertFormatterResult(log.ShortLogFormatter, 'all', b"""\ |
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1556 |
1 John Doe, Jane Rey\t2005-11-22 |
1557 |
add a
|
|
1558 |
||
1559 |
""") |
|
1560 |
||
1561 |
def test_long_default(self): |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1562 |
self.assertFormatterResult(log.LongLogFormatter, None, b"""\ |
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1563 |
------------------------------------------------------------
|
1564 |
revno: 1
|
|
1565 |
author: John Doe <jdoe@example.com>, Jane Rey <jrey@example.com>
|
|
1566 |
committer: Lorem Ipsum <test@example.com>
|
|
1567 |
branch nick: nicky
|
|
1568 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
1569 |
message:
|
|
1570 |
add a
|
|
1571 |
""") |
|
1572 |
||
1573 |
def test_long_committer(self): |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1574 |
self.assertFormatterResult(log.LongLogFormatter, 'committer', b"""\ |
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1575 |
------------------------------------------------------------
|
1576 |
revno: 1
|
|
1577 |
committer: Lorem Ipsum <test@example.com>
|
|
1578 |
branch nick: nicky
|
|
1579 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
1580 |
message:
|
|
1581 |
add a
|
|
1582 |
""") |
|
1583 |
||
1584 |
def test_long_first(self): |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1585 |
self.assertFormatterResult(log.LongLogFormatter, 'first', b"""\ |
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1586 |
------------------------------------------------------------
|
1587 |
revno: 1
|
|
1588 |
author: John Doe <jdoe@example.com>
|
|
1589 |
committer: Lorem Ipsum <test@example.com>
|
|
1590 |
branch nick: nicky
|
|
1591 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
1592 |
message:
|
|
1593 |
add a
|
|
1594 |
""") |
|
1595 |
||
1596 |
def test_long_all(self): |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1597 |
self.assertFormatterResult(log.LongLogFormatter, 'all', b"""\ |
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1598 |
------------------------------------------------------------
|
1599 |
revno: 1
|
|
1600 |
author: John Doe <jdoe@example.com>, Jane Rey <jrey@example.com>
|
|
1601 |
committer: Lorem Ipsum <test@example.com>
|
|
1602 |
branch nick: nicky
|
|
1603 |
timestamp: Tue 2005-11-22 00:00:00 +0000
|
|
1604 |
message:
|
|
1605 |
add a
|
|
1606 |
""") |
|
1607 |
||
1608 |
def test_gnu_changelog_default(self): |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1609 |
self.assertFormatterResult(log.GnuChangelogLogFormatter, None, b"""\ |
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1610 |
2005-11-22 John Doe <jdoe@example.com>
|
1611 |
||
1612 |
\tadd a |
|
1613 |
||
1614 |
""") |
|
1615 |
||
1616 |
def test_gnu_changelog_committer(self): |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1617 |
self.assertFormatterResult(log.GnuChangelogLogFormatter, 'committer', b"""\ |
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1618 |
2005-11-22 Lorem Ipsum <test@example.com>
|
1619 |
||
1620 |
\tadd a |
|
1621 |
||
1622 |
""") |
|
1623 |
||
1624 |
def test_gnu_changelog_first(self): |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1625 |
self.assertFormatterResult(log.GnuChangelogLogFormatter, 'first', b"""\ |
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1626 |
2005-11-22 John Doe <jdoe@example.com>
|
1627 |
||
1628 |
\tadd a |
|
1629 |
||
1630 |
""") |
|
1631 |
||
1632 |
def test_gnu_changelog_all(self): |
|
|
7027.3.3
by Jelmer Vernooij
Add some more bees; support writing both bytes and unicode strings in build_tree_contents. |
1633 |
self.assertFormatterResult(log.GnuChangelogLogFormatter, 'all', b"""\ |
|
4081.3.5
by Martin von Gagern
NEWS and test cases for bzr log --authors. |
1634 |
2005-11-22 John Doe <jdoe@example.com>, Jane Rey <jrey@example.com>
|
1635 |
||
1636 |
\tadd a |
|
1637 |
||
1638 |
""") |
|
|
4081.3.15
by Gary van der Merwe
Merge bzr.dev. |
1639 |
|
|
5691.1.3
by Jelmer Vernooij
Fix whitespace. |
1640 |
|
|
5097.1.12
by Vincent Ladeuil
Implement the --exclude-common-ancestry log option. |
1641 |
class TestLogExcludeAncestry(tests.TestCaseWithTransport): |
1642 |
||
1643 |
def make_branch_with_alternate_ancestries(self, relpath='.'): |
|
|
5155.1.5
by Vincent Ladeuil
Fixed as per Andrew's review. |
1644 |
# See test_merge_sorted_exclude_ancestry below for the difference with
|
1645 |
# bt.per_branch.test_iter_merge_sorted_revision.
|
|
|
6042.1.1
by Thomi Richards
Fix bug #747958 - 'levels' value is no longer overridden in Logger if the user explicitly asked for less details than the logger is capable of providing. |
1646 |
# TestIterMergeSortedRevisionsBushyGraph.
|
|
5155.1.5
by Vincent Ladeuil
Fixed as per Andrew's review. |
1647 |
# make_branch_with_alternate_ancestries
|
1648 |
# and test_merge_sorted_exclude_ancestry
|
|
1649 |
# See the FIXME in assertLogRevnos too.
|
|
|
5097.1.12
by Vincent Ladeuil
Implement the --exclude-common-ancestry log option. |
1650 |
builder = branchbuilder.BranchBuilder(self.get_transport(relpath)) |
1651 |
# 1
|
|
1652 |
# |\
|
|
|
5155.1.3
by Vincent Ladeuil
Fix the performance by finding the relevant subgraph once. |
1653 |
# 2 \
|
1654 |
# | |
|
|
1655 |
# | 1.1.1
|
|
1656 |
# | | \
|
|
|
5097.1.12
by Vincent Ladeuil
Implement the --exclude-common-ancestry log option. |
1657 |
# | | 1.2.1
|
1658 |
# | | /
|
|
1659 |
# | 1.1.2
|
|
1660 |
# | /
|
|
1661 |
# 3
|
|
1662 |
builder.start_series() |
|
|
6816.2.1
by Jelmer Vernooij
Migrate some build_snapshot code over to having revision_id as keyword argument. |
1663 |
builder.build_snapshot(None, [ |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1664 |
('add', ('', b'TREE_ROOT', 'directory', '')), ], |
|
6973.5.2
by Jelmer Vernooij
Add more bees. |
1665 |
revision_id=b'1') |
|
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
1666 |
builder.build_snapshot([b'1'], [], revision_id=b'1.1.1') |
1667 |
builder.build_snapshot([b'1'], [], revision_id=b'2') |
|
1668 |
builder.build_snapshot([b'1.1.1'], [], revision_id=b'1.2.1') |
|
1669 |
builder.build_snapshot([b'1.1.1', b'1.2.1'], [], revision_id=b'1.1.2') |
|
1670 |
builder.build_snapshot([b'2', b'1.1.2'], [], revision_id=b'3') |
|
|
5097.1.12
by Vincent Ladeuil
Implement the --exclude-common-ancestry log option. |
1671 |
builder.finish_series() |
1672 |
br = builder.get_branch() |
|
1673 |
br.lock_read() |
|
1674 |
self.addCleanup(br.unlock) |
|
1675 |
return br |
|
1676 |
||
1677 |
def assertLogRevnos(self, expected_revnos, b, start, end, |
|
|
5268.4.2
by Vincent Ladeuil
Failing whitebox test for bug #575631. |
1678 |
exclude_common_ancestry, generate_merge_revisions=True): |
|
5097.1.12
by Vincent Ladeuil
Implement the --exclude-common-ancestry log option. |
1679 |
# FIXME: the layering in log makes it hard to test intermediate levels,
|
|
6376.1.1
by Vincent Ladeuil
Relax constraints on bzr log -rX..Y by falling back to the slower implementation when needed |
1680 |
# I wish adding filters with their parameters was easier...
|
|
5097.1.12
by Vincent Ladeuil
Implement the --exclude-common-ancestry log option. |
1681 |
# -- vila 20100413
|
1682 |
iter_revs = log._calc_view_revisions( |
|
1683 |
b, start, end, direction='reverse', |
|
|
5268.4.2
by Vincent Ladeuil
Failing whitebox test for bug #575631. |
1684 |
generate_merge_revisions=generate_merge_revisions, |
|
5097.1.12
by Vincent Ladeuil
Implement the --exclude-common-ancestry log option. |
1685 |
exclude_common_ancestry=exclude_common_ancestry) |
1686 |
self.assertEqual(expected_revnos, |
|
1687 |
[revid for revid, revno, depth in iter_revs]) |
|
1688 |
||
1689 |
def test_merge_sorted_exclude_ancestry(self): |
|
1690 |
b = self.make_branch_with_alternate_ancestries() |
|
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1691 |
self.assertLogRevnos([b'3', b'1.1.2', b'1.2.1', b'1.1.1', b'2', b'1'], |
1692 |
b, b'1', b'3', exclude_common_ancestry=False) |
|
|
5155.1.5
by Vincent Ladeuil
Fixed as per Andrew's review. |
1693 |
# '2' is part of the '3' ancestry but not part of '1.1.1' ancestry so
|
1694 |
# it should be mentioned even if merge_sort order will make it appear
|
|
1695 |
# after 1.1.1
|
|
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1696 |
self.assertLogRevnos([b'3', b'1.1.2', b'1.2.1', b'2'], |
1697 |
b, b'1.1.1', b'3', exclude_common_ancestry=True) |
|
|
5097.1.12
by Vincent Ladeuil
Implement the --exclude-common-ancestry log option. |
1698 |
|
|
5268.4.2
by Vincent Ladeuil
Failing whitebox test for bug #575631. |
1699 |
def test_merge_sorted_simple_revnos_exclude_ancestry(self): |
1700 |
b = self.make_branch_with_alternate_ancestries() |
|
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1701 |
self.assertLogRevnos([b'3', b'2'], |
1702 |
b, b'1', b'3', exclude_common_ancestry=True, |
|
|
5268.4.2
by Vincent Ladeuil
Failing whitebox test for bug #575631. |
1703 |
generate_merge_revisions=False) |
|
7045.4.13
by Jelmer Vernooij
Some more test fixes. |
1704 |
self.assertLogRevnos([b'3', b'1.1.2', b'1.2.1', b'1.1.1', b'2'], |
1705 |
b, b'1', b'3', exclude_common_ancestry=True, |
|
|
5268.4.3
by Vincent Ladeuil
Respect --exclude-common-ancestry for linear ancestries. |
1706 |
generate_merge_revisions=True) |
|
5097.1.12
by Vincent Ladeuil
Implement the --exclude-common-ancestry log option. |
1707 |
|
|
6042.1.1
by Thomi Richards
Fix bug #747958 - 'levels' value is no longer overridden in Logger if the user explicitly asked for less details than the logger is capable of providing. |
1708 |
|
1709 |
class TestLogDefaults(TestCaseForLogFormatter): |
|
1710 |
def test_default_log_level(self): |
|
|
6042.1.2
by Thomi Richards
Minor changes as a result of feedback from merge proposal. |
1711 |
""" |
1712 |
Test to ensure that specifying 'levels=1' to make_log_request_dict
|
|
1713 |
doesn't get overwritten when using a LogFormatter that supports more
|
|
1714 |
detail.
|
|
1715 |
Fixes bug #747958.
|
|
1716 |
"""
|
|
|
6042.1.1
by Thomi Richards
Fix bug #747958 - 'levels' value is no longer overridden in Logger if the user explicitly asked for less details than the logger is capable of providing. |
1717 |
wt = self._prepare_tree_with_merges() |
1718 |
b = wt.branch |
|
1719 |
||
1720 |
class CustomLogFormatter(log.LogFormatter): |
|
1721 |
def __init__(self, *args, **kwargs): |
|
1722 |
super(CustomLogFormatter, self).__init__(*args, **kwargs) |
|
1723 |
self.revisions = [] |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1724 |
|
|
6042.1.1
by Thomi Richards
Fix bug #747958 - 'levels' value is no longer overridden in Logger if the user explicitly asked for less details than the logger is capable of providing. |
1725 |
def get_levels(self): |
1726 |
# log formatter supports all levels:
|
|
1727 |
return 0 |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1728 |
|
|
6042.1.1
by Thomi Richards
Fix bug #747958 - 'levels' value is no longer overridden in Logger if the user explicitly asked for less details than the logger is capable of providing. |
1729 |
def log_revision(self, revision): |
1730 |
self.revisions.append(revision) |
|
1731 |
||
1732 |
log_formatter = LogCatcher() |
|
1733 |
# First request we don't specify number of levels, we should get a
|
|
1734 |
# sensible default (whatever the LogFormatter handles - which in this
|
|
1735 |
# case is 0/everything):
|
|
1736 |
request = log.make_log_request_dict(limit=10) |
|
1737 |
log.Logger(b, request).show(log_formatter) |
|
1738 |
# should have all three revisions:
|
|
|
6614.1.3
by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual. |
1739 |
self.assertEqual(len(log_formatter.revisions), 3) |
|
6042.1.1
by Thomi Richards
Fix bug #747958 - 'levels' value is no longer overridden in Logger if the user explicitly asked for less details than the logger is capable of providing. |
1740 |
|
1741 |
del log_formatter |
|
1742 |
log_formatter = LogCatcher() |
|
1743 |
# now explicitly request mainline revisions only:
|
|
1744 |
request = log.make_log_request_dict(limit=10, levels=1) |
|
1745 |
log.Logger(b, request).show(log_formatter) |
|
1746 |
# should now only have 2 revisions:
|
|
|
6614.1.3
by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual. |
1747 |
self.assertEqual(len(log_formatter.revisions), 2) |