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