bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
| 
4763.2.4
by John Arbash Meinel
 merge bzr.2.1 in preparation for NEWS entry.  | 
1  | 
# Copyright (C) 2005-2010 Canonical Ltd
 | 
| 
1685.1.80
by Wouter van Heyst
 more code cleanup  | 
2  | 
#
 | 
| 
974.1.26
by aaron.bentley at utoronto
 merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472  | 
3  | 
# This program is free software; you can redistribute it and/or modify
 | 
4  | 
# it under the terms of the GNU General Public License as published by
 | 
|
5  | 
# the Free Software Foundation; either version 2 of the License, or
 | 
|
6  | 
# (at your option) any later version.
 | 
|
| 
1685.1.80
by Wouter van Heyst
 more code cleanup  | 
7  | 
#
 | 
| 
974.1.26
by aaron.bentley at utoronto
 merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472  | 
8  | 
# This program is distributed in the hope that it will be useful,
 | 
9  | 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
|
10  | 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
|
11  | 
# GNU General Public License for more details.
 | 
|
| 
1685.1.80
by Wouter van Heyst
 more code cleanup  | 
12  | 
#
 | 
| 
974.1.26
by aaron.bentley at utoronto
 merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472  | 
13  | 
# You should have received a copy of the GNU General Public License
 | 
14  | 
# along with this program; if not, write to the Free Software
 | 
|
| 
4183.7.1
by Sabin Iacob
 update FSF mailing address  | 
15  | 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 | 
| 
974.1.26
by aaron.bentley at utoronto
 merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472  | 
16  | 
|
17  | 
import os  | 
|
| 
1123
by Martin Pool
 * move bzr-specific code from testsweet into bzrlib.selftest  | 
18  | 
from cStringIO import StringIO  | 
| 
974.1.26
by aaron.bentley at utoronto
 merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472  | 
19  | 
|
| 
3842.2.1
by Vincent Ladeuil
 Cosmetic changes.  | 
20  | 
from bzrlib import (  | 
21  | 
errors,  | 
|
22  | 
log,  | 
|
23  | 
registry,  | 
|
24  | 
revision,  | 
|
25  | 
revisionspec,  | 
|
| 
4955.4.14
by Vincent Ladeuil
 Properly deprecate log.calculate_view_revisions.  | 
26  | 
symbol_versioning,  | 
| 
3842.2.1
by Vincent Ladeuil
 Cosmetic changes.  | 
27  | 
tests,  | 
28  | 
    )
 | 
|
29  | 
||
30  | 
||
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
31  | 
class TestLogMixin(object):  | 
32  | 
||
33  | 
def wt_commit(self, wt, message, **kwargs):  | 
|
34  | 
"""Use some mostly fixed values for commits to simplify tests.  | 
|
35  | 
||
36  | 
        Tests can use this function to get some commit attributes. The time
 | 
|
37  | 
        stamp is incremented at each commit.
 | 
|
38  | 
        """
 | 
|
39  | 
if getattr(self, 'timestamp', None) is None:  | 
|
40  | 
self.timestamp = 1132617600 # Mon 2005-11-22 00:00:00 +0000  | 
|
41  | 
else:  | 
|
42  | 
self.timestamp += 1 # 1 second between each commit  | 
|
43  | 
kwargs.setdefault('timestamp', self.timestamp)  | 
|
44  | 
kwargs.setdefault('timezone', 0) # UTC  | 
|
45  | 
kwargs.setdefault('committer', 'Joe Foo <joe@foo.com>')  | 
|
46  | 
||
47  | 
return wt.commit(message, **kwargs)  | 
|
48  | 
||
49  | 
||
50  | 
class TestCaseForLogFormatter(tests.TestCaseWithTransport, TestLogMixin):  | 
|
| 
3144.7.9
by Guillermo Gonzalez
 * bzrlib.log.show_roperties don't hide handler errors  | 
51  | 
|
52  | 
def setUp(self):  | 
|
| 
4857.4.3
by John Arbash Meinel
 Handle LineLogFormatter  | 
53  | 
super(TestCaseForLogFormatter, self).setUp()  | 
| 
3144.7.9
by Guillermo Gonzalez
 * bzrlib.log.show_roperties don't hide handler errors  | 
54  | 
        # 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.  | 
55  | 
self.properties_handler_registry = log.properties_handler_registry  | 
| 
4325.4.3
by Vincent Ladeuil
 More cleanups.  | 
56  | 
        # Use a clean registry for log
 | 
| 
3144.7.9
by Guillermo Gonzalez
 * bzrlib.log.show_roperties don't hide handler errors  | 
57  | 
log.properties_handler_registry = registry.Registry()  | 
| 
3842.2.1
by Vincent Ladeuil
 Cosmetic changes.  | 
58  | 
|
| 
4325.4.3
by Vincent Ladeuil
 More cleanups.  | 
59  | 
def restore():  | 
60  | 
log.properties_handler_registry = self.properties_handler_registry  | 
|
61  | 
self.addCleanup(restore)  | 
|
| 
3144.7.9
by Guillermo Gonzalez
 * bzrlib.log.show_roperties don't hide handler errors  | 
62  | 
|
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
63  | 
def assertFormatterResult(self, result, branch, formatter_class,  | 
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
64  | 
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,  | 
65  | 
logfile = self.make_utf8_encoded_stringio()  | 
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
66  | 
if formatter_kwargs is None:  | 
67  | 
formatter_kwargs = {}  | 
|
68  | 
formatter = formatter_class(to_file=logfile, **formatter_kwargs)  | 
|
69  | 
if show_log_kwargs is None:  | 
|
70  | 
show_log_kwargs = {}  | 
|
71  | 
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.  | 
72  | 
self.assertEqualDiff(result, logfile.getvalue())  | 
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
73  | 
|
| 
4857.4.2
by John Arbash Meinel
 Add a 'make_standard_commit' helper, to remove more code duplication.  | 
74  | 
def make_standard_commit(self, branch_nick, **kwargs):  | 
75  | 
wt = self.make_branch_and_tree('.')  | 
|
76  | 
wt.lock_write()  | 
|
77  | 
self.addCleanup(wt.unlock)  | 
|
78  | 
self.build_tree(['a'])  | 
|
79  | 
wt.add(['a'])  | 
|
80  | 
wt.branch.nick = branch_nick  | 
|
81  | 
kwargs.setdefault('committer', 'Lorem Ipsum <test@example.com>')  | 
|
82  | 
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.  | 
83  | 
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.  | 
84  | 
return wt  | 
| 
4857.4.3
by John Arbash Meinel
 Handle LineLogFormatter  | 
85  | 
|
| 
4955.4.1
by Vincent Ladeuil
 Refactor the function into an helper.  | 
86  | 
def make_commits_with_trailing_newlines(self, wt):  | 
87  | 
"""Helper method for LogFormatter tests"""  | 
|
88  | 
b = wt.branch  | 
|
89  | 
b.nick = 'test'  | 
|
| 
4955.4.16
by Vincent Ladeuil
 Be windows-friendly and don't left opened files behind.  | 
90  | 
self.build_tree_contents([('a', 'hello moto\n')])  | 
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
91  | 
self.wt_commit(wt, 'simple log message', rev_id='a1')  | 
| 
4955.4.16
by Vincent Ladeuil
 Be windows-friendly and don't left opened files behind.  | 
92  | 
self.build_tree_contents([('b', 'goodbye\n')])  | 
| 
4955.4.1
by Vincent Ladeuil
 Refactor the function into an helper.  | 
93  | 
wt.add('b')  | 
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
94  | 
self.wt_commit(wt, 'multiline\nlog\nmessage\n', rev_id='a2')  | 
| 
4955.4.1
by Vincent Ladeuil
 Refactor the function into an helper.  | 
95  | 
|
| 
4955.4.16
by Vincent Ladeuil
 Be windows-friendly and don't left opened files behind.  | 
96  | 
self.build_tree_contents([('c', 'just another manic monday\n')])  | 
| 
4955.4.1
by Vincent Ladeuil
 Refactor the function into an helper.  | 
97  | 
wt.add('c')  | 
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
98  | 
self.wt_commit(wt, 'single line with trailing newline\n', rev_id='a3')  | 
| 
4955.4.1
by Vincent Ladeuil
 Refactor the function into an helper.  | 
99  | 
return b  | 
100  | 
||
| 
4857.4.3
by John Arbash Meinel
 Handle LineLogFormatter  | 
101  | 
def _prepare_tree_with_merges(self, with_tags=False):  | 
102  | 
wt = self.make_branch_and_memory_tree('.')  | 
|
103  | 
wt.lock_write()  | 
|
104  | 
self.addCleanup(wt.unlock)  | 
|
105  | 
wt.add('')  | 
|
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
106  | 
self.wt_commit(wt, 'rev-1', rev_id='rev-1')  | 
107  | 
self.wt_commit(wt, 'rev-merged', rev_id='rev-2a')  | 
|
| 
4857.4.3
by John Arbash Meinel
 Handle LineLogFormatter  | 
108  | 
wt.set_parent_ids(['rev-1', 'rev-2a'])  | 
109  | 
wt.branch.set_last_revision_info(1, 'rev-1')  | 
|
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
110  | 
self.wt_commit(wt, 'rev-2', rev_id='rev-2b')  | 
| 
4857.4.3
by John Arbash Meinel
 Handle LineLogFormatter  | 
111  | 
if with_tags:  | 
112  | 
branch = wt.branch  | 
|
113  | 
branch.tags.set_tag('v0.2', 'rev-2b')  | 
|
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
114  | 
self.wt_commit(wt, 'rev-3', rev_id='rev-3')  | 
| 
4857.4.3
by John Arbash Meinel
 Handle LineLogFormatter  | 
115  | 
branch.tags.set_tag('v1.0rc1', 'rev-3')  | 
116  | 
branch.tags.set_tag('v1.0', 'rev-3')  | 
|
117  | 
return wt  | 
|
118  | 
||
| 
3842.2.1
by Vincent Ladeuil
 Cosmetic changes.  | 
119  | 
class LogCatcher(log.LogFormatter):  | 
| 
4325.4.3
by Vincent Ladeuil
 More cleanups.  | 
120  | 
"""Pull log messages into a list rather than displaying them.  | 
| 
974.1.26
by aaron.bentley at utoronto
 merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472  | 
121  | 
|
| 
4325.4.3
by Vincent Ladeuil
 More cleanups.  | 
122  | 
    To simplify testing we save logged revisions here rather than actually
 | 
| 
4325.4.1
by Vincent Ladeuil
 Some cleanups.  | 
123  | 
    formatting anything, so that we can precisely check the result without
 | 
| 
4325.4.3
by Vincent Ladeuil
 More cleanups.  | 
124  | 
    being dependent on the formatting.
 | 
| 
974.1.26
by aaron.bentley at utoronto
 merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472  | 
125  | 
    """
 | 
| 
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.  | 
126  | 
|
| 
4955.4.5
by Vincent Ladeuil
 Start reproducing the problems reported in the bug.  | 
127  | 
supports_merge_revisions = True  | 
| 
2490.1.2
by John Arbash Meinel
 Cleanup according to PEP8 and some other small whitespace fixes  | 
128  | 
supports_delta = True  | 
| 
4955.4.11
by Vincent Ladeuil
 Give some tests a better focus and simplify them accordingly.  | 
129  | 
supports_diff = True  | 
| 
4955.4.5
by Vincent Ladeuil
 Start reproducing the problems reported in the bug.  | 
130  | 
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.  | 
131  | 
|
| 
4955.4.5
by Vincent Ladeuil
 Start reproducing the problems reported in the bug.  | 
132  | 
def __init__(self, *args, **kwargs):  | 
133  | 
kwargs.update(dict(to_file=None))  | 
|
134  | 
super(LogCatcher, self).__init__(*args, **kwargs)  | 
|
| 
4325.4.4
by Vincent Ladeuil
 Clarify LogCatcher purpose.  | 
135  | 
self.revisions = []  | 
| 
1704.2.20
by Martin Pool
 log --line shows revision numbers (Alexander)  | 
136  | 
|
| 
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.  | 
137  | 
def log_revision(self, revision):  | 
| 
4325.4.4
by Vincent Ladeuil
 Clarify LogCatcher purpose.  | 
138  | 
self.revisions.append(revision)  | 
| 
974.1.26
by aaron.bentley at utoronto
 merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472  | 
139  | 
|
140  | 
||
| 
3842.2.1
by Vincent Ladeuil
 Cosmetic changes.  | 
141  | 
class TestShowLog(tests.TestCaseWithTransport):  | 
| 
1102
by Martin Pool
 - merge test refactoring from robertc  | 
142  | 
|
| 
974.1.26
by aaron.bentley at utoronto
 merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472  | 
143  | 
def checkDelta(self, delta, **kw):  | 
| 
3842.2.3
by Vincent Ladeuil
 Yet more cleanup and fix test_file_id_f3 bogus test.  | 
144  | 
"""Check the filenames touched by a delta are as expected.  | 
145  | 
||
146  | 
        Caller only have to pass in the list of files for each part, all
 | 
|
147  | 
        unspecified parts are considered empty (and checked as such).
 | 
|
148  | 
        """
 | 
|
| 
974.1.26
by aaron.bentley at utoronto
 merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472  | 
149  | 
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.  | 
150  | 
            # By default we expect an empty list
 | 
| 
974.1.26
by aaron.bentley at utoronto
 merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472  | 
151  | 
expected = kw.get(n, [])  | 
152  | 
            # strip out only the path components
 | 
|
153  | 
got = [x[0] for x in getattr(delta, n)]  | 
|
| 
3842.2.7
by Vincent Ladeuil
 Fixed as per Jonh's review.  | 
154  | 
self.assertEqual(expected, got)  | 
155  | 
||
156  | 
def assertInvalidRevisonNumber(self, br, start, end):  | 
|
157  | 
lf = LogCatcher()  | 
|
158  | 
self.assertRaises(errors.InvalidRevisionNumber,  | 
|
159  | 
log.show_log, br, lf,  | 
|
160  | 
start_revision=start, end_revision=end)  | 
|
| 
974.1.26
by aaron.bentley at utoronto
 merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472  | 
161  | 
|
| 
974.1.54
by aaron.bentley at utoronto
 Fixed the revno bug in log  | 
162  | 
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.  | 
163  | 
wt = self.make_branch_and_tree('.')  | 
164  | 
b = wt.branch  | 
|
| 
1092.3.4
by Robert Collins
 update symlink branch to integration  | 
165  | 
|
166  | 
lf = LogCatcher()  | 
|
| 
1534.4.26
by Robert Collins
 Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create.  | 
167  | 
wt.commit('empty commit')  | 
| 
3842.2.1
by Vincent Ladeuil
 Cosmetic changes.  | 
168  | 
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.  | 
169  | 
|
170  | 
        # Since there is a single revision in the branch all the combinations
 | 
|
171  | 
        # below should fail.
 | 
|
| 
3842.2.7
by Vincent Ladeuil
 Fixed as per Jonh's review.  | 
172  | 
self.assertInvalidRevisonNumber(b, 2, 1)  | 
173  | 
self.assertInvalidRevisonNumber(b, 1, 2)  | 
|
174  | 
self.assertInvalidRevisonNumber(b, 0, 2)  | 
|
175  | 
self.assertInvalidRevisonNumber(b, 1, 0)  | 
|
176  | 
self.assertInvalidRevisonNumber(b, -1, 1)  | 
|
177  | 
self.assertInvalidRevisonNumber(b, 1, -1)  | 
|
| 
3842.2.3
by Vincent Ladeuil
 Yet more cleanup and fix test_file_id_f3 bogus test.  | 
178  | 
|
179  | 
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.  | 
180  | 
wt = self.make_branch_and_tree('.')  | 
| 
974.1.26
by aaron.bentley at utoronto
 merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472  | 
181  | 
|
182  | 
lf = LogCatcher()  | 
|
| 
3842.2.3
by Vincent Ladeuil
 Yet more cleanup and fix test_file_id_f3 bogus test.  | 
183  | 
log.show_log(wt.branch, lf)  | 
| 
974.1.26
by aaron.bentley at utoronto
 merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472  | 
184  | 
        # no entries yet
 | 
| 
4325.4.4
by Vincent Ladeuil
 Clarify LogCatcher purpose.  | 
185  | 
self.assertEqual([], lf.revisions)  | 
| 
3842.2.3
by Vincent Ladeuil
 Yet more cleanup and fix test_file_id_f3 bogus test.  | 
186  | 
|
187  | 
def test_empty_commit(self):  | 
|
188  | 
wt = self.make_branch_and_tree('.')  | 
|
| 
974.1.26
by aaron.bentley at utoronto
 merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472  | 
189  | 
|
| 
1534.4.36
by Robert Collins
 Finish deprecating Branch.working_tree()  | 
190  | 
wt.commit('empty commit')  | 
| 
974.1.26
by aaron.bentley at utoronto
 merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472  | 
191  | 
lf = LogCatcher()  | 
| 
3842.2.3
by Vincent Ladeuil
 Yet more cleanup and fix test_file_id_f3 bogus test.  | 
192  | 
log.show_log(wt.branch, lf, verbose=True)  | 
| 
4325.4.4
by Vincent Ladeuil
 Clarify LogCatcher purpose.  | 
193  | 
revs = lf.revisions  | 
194  | 
self.assertEqual(1, len(revs))  | 
|
195  | 
self.assertEqual('1', revs[0].revno)  | 
|
196  | 
self.assertEqual('empty commit', revs[0].rev.message)  | 
|
197  | 
self.checkDelta(revs[0].delta)  | 
|
| 
974.1.26
by aaron.bentley at utoronto
 merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472  | 
198  | 
|
| 
3842.2.3
by Vincent Ladeuil
 Yet more cleanup and fix test_file_id_f3 bogus test.  | 
199  | 
def test_simple_commit(self):  | 
200  | 
wt = self.make_branch_and_tree('.')  | 
|
201  | 
wt.commit('empty commit')  | 
|
| 
974.1.26
by aaron.bentley at utoronto
 merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472  | 
202  | 
self.build_tree(['hello'])  | 
| 
1534.4.36
by Robert Collins
 Finish deprecating Branch.working_tree()  | 
203  | 
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.  | 
204  | 
wt.commit('add one file',  | 
205  | 
committer=u'\u013d\xf3r\xe9m \xcdp\u0161\xfam '  | 
|
206  | 
u'<test@example.com>')  | 
|
| 
974.1.26
by aaron.bentley at utoronto
 merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472  | 
207  | 
lf = LogCatcher()  | 
| 
3842.2.3
by Vincent Ladeuil
 Yet more cleanup and fix test_file_id_f3 bogus test.  | 
208  | 
log.show_log(wt.branch, lf, verbose=True)  | 
| 
4325.4.4
by Vincent Ladeuil
 Clarify LogCatcher purpose.  | 
209  | 
self.assertEqual(2, len(lf.revisions))  | 
| 
974.1.26
by aaron.bentley at utoronto
 merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472  | 
210  | 
        # first one is most recent
 | 
| 
4325.4.4
by Vincent Ladeuil
 Clarify LogCatcher purpose.  | 
211  | 
log_entry = lf.revisions[0]  | 
| 
3842.2.7
by Vincent Ladeuil
 Fixed as per Jonh's review.  | 
212  | 
self.assertEqual('2', log_entry.revno)  | 
213  | 
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.  | 
214  | 
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.  | 
215  | 
|
| 
3842.2.3
by Vincent Ladeuil
 Yet more cleanup and fix test_file_id_f3 bogus test.  | 
216  | 
def test_commit_message_with_control_chars(self):  | 
217  | 
wt = self.make_branch_and_tree('.')  | 
|
| 
3831.1.6
by John Arbash Meinel
 For the simple-log tests, avoid using '\r' in the test.  | 
218  | 
msg = u"All 8-bit chars: " + ''.join([unichr(x) for x in range(256)])  | 
219  | 
msg = msg.replace(u'\r', u'\n')  | 
|
| 
1534.4.36
by Robert Collins
 Finish deprecating Branch.working_tree()  | 
220  | 
wt.commit(msg)  | 
| 
1185.11.5
by John Arbash Meinel
 Merged up-to-date against mainline, still broken.  | 
221  | 
lf = LogCatcher()  | 
| 
3842.2.3
by Vincent Ladeuil
 Yet more cleanup and fix test_file_id_f3 bogus test.  | 
222  | 
log.show_log(wt.branch, lf, verbose=True)  | 
| 
4325.4.4
by Vincent Ladeuil
 Clarify LogCatcher purpose.  | 
223  | 
committed_msg = lf.revisions[0].rev.message  | 
| 
4627.1.1
by Robert Collins
 Review feedback per IanC.  | 
224  | 
if wt.branch.repository._serializer.squashes_xml_invalid_characters:  | 
225  | 
self.assertNotEqual(msg, committed_msg)  | 
|
226  | 
self.assertTrue(len(committed_msg) > len(msg))  | 
|
227  | 
else:  | 
|
228  | 
self.assertEqual(msg, committed_msg)  | 
|
| 
1393.4.2
by Harald Meland
 Cleanup + better test of commit-msg control character escape code.  | 
229  | 
|
| 
3842.2.3
by Vincent Ladeuil
 Yet more cleanup and fix test_file_id_f3 bogus test.  | 
230  | 
def test_commit_message_without_control_chars(self):  | 
231  | 
wt = self.make_branch_and_tree('.')  | 
|
| 
1393.4.2
by Harald Meland
 Cleanup + better test of commit-msg control character escape code.  | 
232  | 
        # escaped.  As ElementTree apparently does some kind of
 | 
233  | 
        # newline conversion, neither LF (\x0A) nor CR (\x0D) are
 | 
|
234  | 
        # included in the test commit message, even though they are
 | 
|
235  | 
        # valid XML 1.0 characters.
 | 
|
236  | 
msg = "\x09" + ''.join([unichr(x) for x in range(0x20, 256)])  | 
|
| 
1534.4.36
by Robert Collins
 Finish deprecating Branch.working_tree()  | 
237  | 
wt.commit(msg)  | 
| 
1393.4.2
by Harald Meland
 Cleanup + better test of commit-msg control character escape code.  | 
238  | 
lf = LogCatcher()  | 
| 
3842.2.3
by Vincent Ladeuil
 Yet more cleanup and fix test_file_id_f3 bogus test.  | 
239  | 
log.show_log(wt.branch, lf, verbose=True)  | 
| 
4325.4.4
by Vincent Ladeuil
 Clarify LogCatcher purpose.  | 
240  | 
committed_msg = lf.revisions[0].rev.message  | 
| 
3842.2.7
by Vincent Ladeuil
 Fixed as per Jonh's review.  | 
241  | 
self.assertEqual(msg, committed_msg)  | 
| 
1185.31.22
by John Arbash Meinel
 [merge] bzr.dev  | 
242  | 
|
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
243  | 
def test_deltas_in_merge_revisions(self):  | 
244  | 
"""Check deltas created for both mainline and merge revisions"""  | 
|
245  | 
wt = self.make_branch_and_tree('parent')  | 
|
246  | 
self.build_tree(['parent/file1', 'parent/file2', 'parent/file3'])  | 
|
247  | 
wt.add('file1')  | 
|
248  | 
wt.add('file2')  | 
|
249  | 
wt.commit(message='add file1 and file2')  | 
|
| 
2581.1.6
by Martin Pool
 fix up more run_bzr callers  | 
250  | 
self.run_bzr('branch parent child')  | 
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
251  | 
os.unlink('child/file1')  | 
| 
2911.6.1
by Blake Winton
 Change 'print >> f,'s to 'f.write('s.  | 
252  | 
file('child/file2', 'wb').write('hello\n')  | 
| 
2581.1.6
by Martin Pool
 fix up more run_bzr callers  | 
253  | 
self.run_bzr(['commit', '-m', 'remove file1 and modify file2',  | 
254  | 
'child'])  | 
|
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
255  | 
os.chdir('parent')  | 
| 
2581.1.6
by Martin Pool
 fix up more run_bzr callers  | 
256  | 
self.run_bzr('merge ../child')  | 
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
257  | 
wt.commit('merge child branch')  | 
258  | 
os.chdir('..')  | 
|
259  | 
b = wt.branch  | 
|
260  | 
lf = LogCatcher()  | 
|
261  | 
lf.supports_merge_revisions = True  | 
|
| 
3842.2.1
by Vincent Ladeuil
 Cosmetic changes.  | 
262  | 
log.show_log(b, lf, verbose=True)  | 
| 
3842.2.7
by Vincent Ladeuil
 Fixed as per Jonh's review.  | 
263  | 
|
| 
4325.4.4
by Vincent Ladeuil
 Clarify LogCatcher purpose.  | 
264  | 
revs = lf.revisions  | 
265  | 
self.assertEqual(3, len(revs))  | 
|
| 
3842.2.7
by Vincent Ladeuil
 Fixed as per Jonh's review.  | 
266  | 
|
| 
4325.4.4
by Vincent Ladeuil
 Clarify LogCatcher purpose.  | 
267  | 
logentry = revs[0]  | 
| 
3842.2.7
by Vincent Ladeuil
 Fixed as per Jonh's review.  | 
268  | 
self.assertEqual('2', logentry.revno)  | 
269  | 
self.assertEqual('merge child branch', logentry.rev.message)  | 
|
270  | 
self.checkDelta(logentry.delta, removed=['file1'], modified=['file2'])  | 
|
271  | 
||
| 
4325.4.4
by Vincent Ladeuil
 Clarify LogCatcher purpose.  | 
272  | 
logentry = revs[1]  | 
| 
3842.2.7
by Vincent Ladeuil
 Fixed as per Jonh's review.  | 
273  | 
self.assertEqual('1.1.1', logentry.revno)  | 
274  | 
self.assertEqual('remove file1 and modify file2', logentry.rev.message)  | 
|
275  | 
self.checkDelta(logentry.delta, removed=['file1'], modified=['file2'])  | 
|
276  | 
||
| 
4325.4.4
by Vincent Ladeuil
 Clarify LogCatcher purpose.  | 
277  | 
logentry = revs[2]  | 
| 
3842.2.7
by Vincent Ladeuil
 Fixed as per Jonh's review.  | 
278  | 
self.assertEqual('1', logentry.revno)  | 
279  | 
self.assertEqual('add file1 and file2', logentry.rev.message)  | 
|
280  | 
self.checkDelta(logentry.delta, added=['file1', 'file2'])  | 
|
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
281  | 
|
282  | 
||
| 
4857.4.3
by John Arbash Meinel
 Handle LineLogFormatter  | 
283  | 
class TestShortLogFormatter(TestCaseForLogFormatter):  | 
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
284  | 
|
| 
1185.31.21
by John Arbash Meinel
 Added test for log formatting, found bug when redirecting short logs to a file instead of stdout.  | 
285  | 
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.  | 
286  | 
wt = self.make_branch_and_tree('.')  | 
| 
4955.4.1
by Vincent Ladeuil
 Refactor the function into an helper.  | 
287  | 
b = self.make_commits_with_trailing_newlines(wt)  | 
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
288  | 
self.assertFormatterResult("""\  | 
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
289  | 
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.  | 
290  | 
      single line with trailing newline
 | 
291  | 
||
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
292  | 
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.  | 
293  | 
      multiline
 | 
294  | 
      log
 | 
|
295  | 
      message
 | 
|
296  | 
||
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
297  | 
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.  | 
298  | 
      simple log message
 | 
299  | 
||
| 
3842.2.7
by Vincent Ladeuil
 Fixed as per Jonh's review.  | 
300  | 
""",  | 
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
301  | 
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.  | 
302  | 
|
| 
2997.1.1
by Kent Gibson
 Support logging single merge revisions with short and line log formatters.  | 
303  | 
def test_short_log_with_merges(self):  | 
| 
3946.3.2
by Ian Clatworthy
 add tests & NEWS item  | 
304  | 
wt = self._prepare_tree_with_merges()  | 
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
305  | 
self.assertFormatterResult("""\  | 
| 
2997.1.1
by Kent Gibson
 Support logging single merge revisions with short and line log formatters.  | 
306  | 
2 Joe Foo\t2005-11-22 [merge]  | 
307  | 
      rev-2
 | 
|
308  | 
||
309  | 
1 Joe Foo\t2005-11-22  | 
|
310  | 
      rev-1
 | 
|
311  | 
||
| 
4221.2.3
by Ian Clatworthy
 jam feedback: don't show advice if --levels explicitly given  | 
312  | 
""",  | 
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
313  | 
wt.branch, log.ShortLogFormatter)  | 
| 
4221.2.3
by Ian Clatworthy
 jam feedback: don't show advice if --levels explicitly given  | 
314  | 
|
315  | 
def test_short_log_with_merges_and_advice(self):  | 
|
316  | 
wt = self._prepare_tree_with_merges()  | 
|
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
317  | 
self.assertFormatterResult("""\  | 
| 
4221.2.3
by Ian Clatworthy
 jam feedback: don't show advice if --levels explicitly given  | 
318  | 
2 Joe Foo\t2005-11-22 [merge]  | 
319  | 
      rev-2
 | 
|
320  | 
||
321  | 
1 Joe Foo\t2005-11-22  | 
|
322  | 
      rev-1
 | 
|
323  | 
||
| 
4221.2.1
by Ian Clatworthy
 --include-merges as an alias for --levels 0 in log  | 
324  | 
Use --include-merges or -n0 to see merged revisions.
 | 
| 
3842.2.7
by Vincent Ladeuil
 Fixed as per Jonh's review.  | 
325  | 
""",  | 
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
326  | 
wt.branch, log.ShortLogFormatter,  | 
327  | 
formatter_kwargs=dict(show_advice=True))  | 
|
| 
2997.1.1
by Kent Gibson
 Support logging single merge revisions with short and line log formatters.  | 
328  | 
|
| 
3943.4.2
by John Arbash Meinel
 Add a test case which exercises this code path.  | 
329  | 
def test_short_log_with_merges_and_range(self):  | 
| 
4955.4.19
by Vincent Ladeuil
 Less code duplication.  | 
330  | 
wt = self._prepare_tree_with_merges()  | 
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
331  | 
self.wt_commit(wt, 'rev-3a', rev_id='rev-3a')  | 
| 
3943.4.2
by John Arbash Meinel
 Add a test case which exercises this code path.  | 
332  | 
wt.branch.set_last_revision_info(2, 'rev-2b')  | 
333  | 
wt.set_parent_ids(['rev-2b', 'rev-3a'])  | 
|
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
334  | 
self.wt_commit(wt, 'rev-3b', rev_id='rev-3b')  | 
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
335  | 
self.assertFormatterResult("""\  | 
| 
3943.4.2
by John Arbash Meinel
 Add a test case which exercises this code path.  | 
336  | 
3 Joe Foo\t2005-11-22 [merge]  | 
337  | 
      rev-3b
 | 
|
338  | 
||
339  | 
2 Joe Foo\t2005-11-22 [merge]  | 
|
| 
4955.4.19
by Vincent Ladeuil
 Less code duplication.  | 
340  | 
      rev-2
 | 
| 
3943.4.2
by John Arbash Meinel
 Add a test case which exercises this code path.  | 
341  | 
|
342  | 
""",  | 
|
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
343  | 
wt.branch, log.ShortLogFormatter,  | 
344  | 
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.  | 
345  | 
|
| 
3946.3.2
by Ian Clatworthy
 add tests & NEWS item  | 
346  | 
def test_short_log_with_tags(self):  | 
347  | 
wt = self._prepare_tree_with_merges(with_tags=True)  | 
|
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
348  | 
self.assertFormatterResult("""\  | 
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
349  | 
3 Joe Foo\t2005-11-22 {v1.0, v1.0rc1}  | 
| 
3946.3.2
by Ian Clatworthy
 add tests & NEWS item  | 
350  | 
      rev-3
 | 
351  | 
||
352  | 
2 Joe Foo\t2005-11-22 {v0.2} [merge]  | 
|
353  | 
      rev-2
 | 
|
354  | 
||
355  | 
1 Joe Foo\t2005-11-22  | 
|
356  | 
      rev-1
 | 
|
357  | 
||
358  | 
""",  | 
|
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
359  | 
wt.branch, log.ShortLogFormatter)  | 
| 
3946.3.2
by Ian Clatworthy
 add tests & NEWS item  | 
360  | 
|
| 
2997.1.1
by Kent Gibson
 Support logging single merge revisions with short and line log formatters.  | 
361  | 
def test_short_log_single_merge_revision(self):  | 
| 
4955.4.19
by Vincent Ladeuil
 Less code duplication.  | 
362  | 
wt = self._prepare_tree_with_merges()  | 
| 
3842.2.3
by Vincent Ladeuil
 Yet more cleanup and fix test_file_id_f3 bogus test.  | 
363  | 
revspec = revisionspec.RevisionSpec.from_string('1.1.1')  | 
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
364  | 
rev = revspec.in_history(wt.branch)  | 
365  | 
self.assertFormatterResult("""\  | 
|
| 
3947.1.10
by Ian Clatworthy
 review feedback from vila  | 
366  | 
1.1.1 Joe Foo\t2005-11-22  | 
367  | 
            rev-merged
 | 
|
| 
2997.1.1
by Kent Gibson
 Support logging single merge revisions with short and line log formatters.  | 
368  | 
|
| 
3842.2.7
by Vincent Ladeuil
 Fixed as per Jonh's review.  | 
369  | 
""",  | 
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
370  | 
wt.branch, log.ShortLogFormatter,  | 
371  | 
show_log_kwargs=dict(start_revision=rev, end_revision=rev))  | 
|
372  | 
||
373  | 
||
| 
4857.4.3
by John Arbash Meinel
 Handle LineLogFormatter  | 
374  | 
class TestShortLogFormatterWithMergeRevisions(TestCaseForLogFormatter):  | 
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
375  | 
|
376  | 
def test_short_merge_revs_log_with_merges(self):  | 
|
| 
4955.4.19
by Vincent Ladeuil
 Less code duplication.  | 
377  | 
wt = self._prepare_tree_with_merges()  | 
| 
3947.1.7
by Ian Clatworthy
 tweak indenting/offsetting for --short given dotted revno lengths  | 
378  | 
        # Note that the 1.1.1 indenting is in fact correct given that
 | 
379  | 
        # the revision numbers are right justified within 5 characters
 | 
|
380  | 
        # for mainline revnos and 9 characters for dotted revnos.
 | 
|
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
381  | 
self.assertFormatterResult("""\  | 
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
382  | 
2 Joe Foo\t2005-11-22 [merge]  | 
383  | 
      rev-2
 | 
|
384  | 
||
| 
3947.1.10
by Ian Clatworthy
 review feedback from vila  | 
385  | 
1.1.1 Joe Foo\t2005-11-22  | 
386  | 
                rev-merged
 | 
|
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
387  | 
|
388  | 
1 Joe Foo\t2005-11-22  | 
|
389  | 
      rev-1
 | 
|
390  | 
||
391  | 
""",  | 
|
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
392  | 
wt.branch, log.ShortLogFormatter,  | 
393  | 
formatter_kwargs=dict(levels=0))  | 
|
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
394  | 
|
395  | 
def test_short_merge_revs_log_single_merge_revision(self):  | 
|
| 
4955.4.19
by Vincent Ladeuil
 Less code duplication.  | 
396  | 
wt = self._prepare_tree_with_merges()  | 
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
397  | 
revspec = revisionspec.RevisionSpec.from_string('1.1.1')  | 
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
398  | 
rev = revspec.in_history(wt.branch)  | 
399  | 
self.assertFormatterResult("""\  | 
|
| 
3947.1.10
by Ian Clatworthy
 review feedback from vila  | 
400  | 
1.1.1 Joe Foo\t2005-11-22  | 
401  | 
            rev-merged
 | 
|
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
402  | 
|
403  | 
""",  | 
|
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
404  | 
wt.branch, log.ShortLogFormatter,  | 
405  | 
formatter_kwargs=dict(levels=0),  | 
|
406  | 
show_log_kwargs=dict(start_revision=rev, end_revision=rev))  | 
|
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
407  | 
|
408  | 
||
| 
4857.4.3
by John Arbash Meinel
 Handle LineLogFormatter  | 
409  | 
class TestLongLogFormatter(TestCaseForLogFormatter):  | 
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
410  | 
|
| 
1185.33.41
by Martin Pool
 Fix regression of 'bzr log -v' - it wasn't showing changed files at all. (#4676)  | 
411  | 
def test_verbose_log(self):  | 
412  | 
"""Verbose log includes changed files  | 
|
| 
3943.8.1
by Marius Kruger
 remove all trailing whitespace from bzr source  | 
413  | 
|
| 
1185.33.41
by Martin Pool
 Fix regression of 'bzr log -v' - it wasn't showing changed files at all. (#4676)  | 
414  | 
        bug #4676
 | 
415  | 
        """
 | 
|
| 
4857.4.4
by John Arbash Meinel
 One more standard-commit  | 
416  | 
wt = self.make_standard_commit('test_verbose_log', authors=[])  | 
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
417  | 
self.assertFormatterResult('''\  | 
| 
1185.33.41
by Martin Pool
 Fix regression of 'bzr log -v' - it wasn't showing changed files at all. (#4676)  | 
418  | 
------------------------------------------------------------
 | 
419  | 
revno: 1
 | 
|
| 
2671.5.7
by Lukáš Lalinsky
 Rename get_author to get_apparent_author, revert the long log back to displaying the committer.  | 
420  | 
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)  | 
421  | 
branch nick: test_verbose_log
 | 
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
422  | 
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)  | 
423  | 
message:
 | 
424  | 
  add a
 | 
|
425  | 
added:
 | 
|
426  | 
  a
 | 
|
| 
3842.2.7
by Vincent Ladeuil
 Fixed as per Jonh's review.  | 
427  | 
''',  | 
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
428  | 
wt.branch, log.LongLogFormatter,  | 
| 
4857.4.5
by John Arbash Meinel
 We don't need the utf8 option, no test actually wanted to run without it,  | 
429  | 
show_log_kwargs=dict(verbose=True))  | 
| 
1185.85.4
by John Arbash Meinel
 currently broken, trying to fix things up.  | 
430  | 
|
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
431  | 
def test_merges_are_indented_by_level(self):  | 
432  | 
wt = self.make_branch_and_tree('parent')  | 
|
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
433  | 
self.wt_commit(wt, 'first post')  | 
434  | 
child_wt = wt.bzrdir.sprout('child').open_workingtree()  | 
|
435  | 
self.wt_commit(child_wt, 'branch 1')  | 
|
436  | 
smallerchild_wt = wt.bzrdir.sprout('smallerchild').open_workingtree()  | 
|
437  | 
self.wt_commit(smallerchild_wt, 'branch 2')  | 
|
438  | 
child_wt.merge_from_branch(smallerchild_wt.branch)  | 
|
439  | 
self.wt_commit(child_wt, 'merge branch 2')  | 
|
440  | 
wt.merge_from_branch(child_wt.branch)  | 
|
441  | 
self.wt_commit(wt, 'merge branch 1')  | 
|
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
442  | 
self.assertFormatterResult("""\  | 
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
443  | 
------------------------------------------------------------
 | 
| 
4208.2.1
by Ian Clatworthy
 merge indicators in log --long  | 
444  | 
revno: 2 [merge]
 | 
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
445  | 
committer: Joe Foo <joe@foo.com>
 | 
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
446  | 
branch nick: parent
 | 
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
447  | 
timestamp: Tue 2005-11-22 00:00:04 +0000
 | 
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
448  | 
message:
 | 
449  | 
  merge branch 1
 | 
|
450  | 
    ------------------------------------------------------------
 | 
|
| 
4208.2.1
by Ian Clatworthy
 merge indicators in log --long  | 
451  | 
    revno: 1.1.2 [merge]
 | 
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
452  | 
    committer: Joe Foo <joe@foo.com>
 | 
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
453  | 
    branch nick: child
 | 
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
454  | 
    timestamp: Tue 2005-11-22 00:00:03 +0000
 | 
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
455  | 
    message:
 | 
456  | 
      merge branch 2
 | 
|
457  | 
        ------------------------------------------------------------
 | 
|
| 
3170.3.4
by John Arbash Meinel
 Update the tests for the new revision numbering.  | 
458  | 
        revno: 1.2.1
 | 
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
459  | 
        committer: Joe Foo <joe@foo.com>
 | 
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
460  | 
        branch nick: smallerchild
 | 
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
461  | 
        timestamp: Tue 2005-11-22 00:00:02 +0000
 | 
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
462  | 
        message:
 | 
463  | 
          branch 2
 | 
|
464  | 
    ------------------------------------------------------------
 | 
|
465  | 
    revno: 1.1.1
 | 
|
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
466  | 
    committer: Joe Foo <joe@foo.com>
 | 
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
467  | 
    branch nick: child
 | 
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
468  | 
    timestamp: Tue 2005-11-22 00:00:01 +0000
 | 
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
469  | 
    message:
 | 
470  | 
      branch 1
 | 
|
471  | 
------------------------------------------------------------
 | 
|
472  | 
revno: 1
 | 
|
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
473  | 
committer: Joe Foo <joe@foo.com>
 | 
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
474  | 
branch nick: parent
 | 
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
475  | 
timestamp: Tue 2005-11-22 00:00:00 +0000
 | 
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
476  | 
message:
 | 
477  | 
  first post
 | 
|
| 
3842.2.7
by Vincent Ladeuil
 Fixed as per Jonh's review.  | 
478  | 
""",  | 
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
479  | 
wt.branch, log.LongLogFormatter,  | 
480  | 
formatter_kwargs=dict(levels=0),  | 
|
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
481  | 
show_log_kwargs=dict(verbose=True))  | 
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
482  | 
|
483  | 
def test_verbose_merge_revisions_contain_deltas(self):  | 
|
484  | 
wt = self.make_branch_and_tree('parent')  | 
|
485  | 
self.build_tree(['parent/f1', 'parent/f2'])  | 
|
486  | 
wt.add(['f1','f2'])  | 
|
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
487  | 
self.wt_commit(wt, 'first post')  | 
488  | 
child_wt = wt.bzrdir.sprout('child').open_workingtree()  | 
|
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
489  | 
os.unlink('child/f1')  | 
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
490  | 
self.build_tree_contents([('child/f2', 'hello\n')])  | 
491  | 
self.wt_commit(child_wt, 'removed f1 and modified f2')  | 
|
492  | 
wt.merge_from_branch(child_wt.branch)  | 
|
493  | 
self.wt_commit(wt, 'merge branch 1')  | 
|
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
494  | 
self.assertFormatterResult("""\  | 
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
495  | 
------------------------------------------------------------
 | 
| 
4208.2.1
by Ian Clatworthy
 merge indicators in log --long  | 
496  | 
revno: 2 [merge]
 | 
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
497  | 
committer: Joe Foo <joe@foo.com>
 | 
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
498  | 
branch nick: parent
 | 
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
499  | 
timestamp: Tue 2005-11-22 00:00:02 +0000
 | 
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
500  | 
message:
 | 
501  | 
  merge branch 1
 | 
|
502  | 
removed:
 | 
|
503  | 
  f1
 | 
|
504  | 
modified:
 | 
|
505  | 
  f2
 | 
|
506  | 
    ------------------------------------------------------------
 | 
|
507  | 
    revno: 1.1.1
 | 
|
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
508  | 
    committer: Joe Foo <joe@foo.com>
 | 
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
509  | 
    branch nick: child
 | 
| 
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:01 +0000
 | 
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
511  | 
    message:
 | 
512  | 
      removed f1 and modified f2
 | 
|
513  | 
    removed:
 | 
|
514  | 
      f1
 | 
|
515  | 
    modified:
 | 
|
516  | 
      f2
 | 
|
517  | 
------------------------------------------------------------
 | 
|
518  | 
revno: 1
 | 
|
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
519  | 
committer: Joe Foo <joe@foo.com>
 | 
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
520  | 
branch nick: parent
 | 
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
521  | 
timestamp: Tue 2005-11-22 00:00:00 +0000
 | 
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
522  | 
message:
 | 
523  | 
  first post
 | 
|
524  | 
added:
 | 
|
525  | 
  f1
 | 
|
526  | 
  f2
 | 
|
| 
3842.2.7
by Vincent Ladeuil
 Fixed as per Jonh's review.  | 
527  | 
""",  | 
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
528  | 
wt.branch, log.LongLogFormatter,  | 
529  | 
formatter_kwargs=dict(levels=0),  | 
|
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
530  | 
show_log_kwargs=dict(verbose=True))  | 
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
531  | 
|
532  | 
def test_trailing_newlines(self):  | 
|
533  | 
wt = self.make_branch_and_tree('.')  | 
|
| 
4955.4.1
by Vincent Ladeuil
 Refactor the function into an helper.  | 
534  | 
b = self.make_commits_with_trailing_newlines(wt)  | 
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
535  | 
self.assertFormatterResult("""\  | 
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
536  | 
------------------------------------------------------------
 | 
537  | 
revno: 3
 | 
|
| 
2671.5.7
by Lukáš Lalinsky
 Rename get_author to get_apparent_author, revert the long log back to displaying the committer.  | 
538  | 
committer: Joe Foo <joe@foo.com>
 | 
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
539  | 
branch nick: test
 | 
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
540  | 
timestamp: Tue 2005-11-22 00:00:02 +0000
 | 
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
541  | 
message:
 | 
542  | 
  single line with trailing newline
 | 
|
543  | 
------------------------------------------------------------
 | 
|
544  | 
revno: 2
 | 
|
545  | 
committer: Joe Foo <joe@foo.com>
 | 
|
546  | 
branch nick: test
 | 
|
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
547  | 
timestamp: Tue 2005-11-22 00:00:01 +0000
 | 
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
548  | 
message:
 | 
549  | 
  multiline
 | 
|
550  | 
  log
 | 
|
551  | 
  message
 | 
|
552  | 
------------------------------------------------------------
 | 
|
553  | 
revno: 1
 | 
|
| 
2671.5.7
by Lukáš Lalinsky
 Rename get_author to get_apparent_author, revert the long log back to displaying the committer.  | 
554  | 
committer: Joe Foo <joe@foo.com>
 | 
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
555  | 
branch nick: test
 | 
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
556  | 
timestamp: Tue 2005-11-22 00:00:00 +0000
 | 
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
557  | 
message:
 | 
558  | 
  simple log message
 | 
|
| 
3842.2.7
by Vincent Ladeuil
 Fixed as per Jonh's review.  | 
559  | 
""",  | 
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
560  | 
b, log.LongLogFormatter)  | 
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
561  | 
|
| 
2671.5.7
by Lukáš Lalinsky
 Rename get_author to get_apparent_author, revert the long log back to displaying the committer.  | 
562  | 
def test_author_in_log(self):  | 
563  | 
"""Log includes the author name if it's set in  | 
|
564  | 
        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.  | 
565  | 
        """
 | 
| 
4857.4.2
by John Arbash Meinel
 Add a 'make_standard_commit' helper, to remove more code duplication.  | 
566  | 
wt = self.make_standard_commit('test_author_log',  | 
567  | 
authors=['John Doe <jdoe@example.com>',  | 
|
568  | 
'Jane Rey <jrey@example.com>'])  | 
|
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
569  | 
self.assertFormatterResult("""\  | 
| 
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.  | 
570  | 
------------------------------------------------------------
 | 
571  | 
revno: 1
 | 
|
| 
4056.2.3
by James Westby
 Use a new "authors" revision property to allow multiple authors  | 
572  | 
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.  | 
573  | 
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.  | 
574  | 
branch nick: test_author_log
 | 
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
575  | 
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.  | 
576  | 
message:
 | 
| 
4857.4.2
by John Arbash Meinel
 Add a 'make_standard_commit' helper, to remove more code duplication.  | 
577  | 
  add a
 | 
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
578  | 
""",  | 
| 
4857.4.5
by John Arbash Meinel
 We don't need the utf8 option, no test actually wanted to run without it,  | 
579  | 
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.  | 
580  | 
|
| 
3144.7.9
by Guillermo Gonzalez
 * bzrlib.log.show_roperties don't hide handler errors  | 
581  | 
def test_properties_in_log(self):  | 
| 
3943.8.1
by Marius Kruger
 remove all trailing whitespace from bzr source  | 
582  | 
"""Log includes the custom properties returned by the registered  | 
| 
3144.7.9
by Guillermo Gonzalez
 * bzrlib.log.show_roperties don't hide handler errors  | 
583  | 
        handlers.
 | 
584  | 
        """
 | 
|
| 
4857.4.2
by John Arbash Meinel
 Add a 'make_standard_commit' helper, to remove more code duplication.  | 
585  | 
wt = self.make_standard_commit('test_properties_in_log')  | 
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
586  | 
def trivial_custom_prop_handler(revision):  | 
587  | 
return {'test_prop':'test_value'}  | 
|
| 
3842.2.1
by Vincent Ladeuil
 Cosmetic changes.  | 
588  | 
|
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
589  | 
        # Cleaned up in setUp()
 | 
590  | 
log.properties_handler_registry.register(  | 
|
591  | 
'trivial_custom_prop_handler',  | 
|
592  | 
trivial_custom_prop_handler)  | 
|
593  | 
self.assertFormatterResult("""\  | 
|
| 
3144.7.9
by Guillermo Gonzalez
 * bzrlib.log.show_roperties don't hide handler errors  | 
594  | 
------------------------------------------------------------
 | 
595  | 
revno: 1
 | 
|
596  | 
test_prop: test_value
 | 
|
597  | 
author: John Doe <jdoe@example.com>
 | 
|
598  | 
committer: Lorem Ipsum <test@example.com>
 | 
|
| 
3144.7.13
by Guillermo Gonzalez
 * fixed typo LogFormatter.show_properties in docstring  | 
599  | 
branch nick: test_properties_in_log
 | 
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
600  | 
timestamp: Tue 2005-11-22 00:00:00 +0000
 | 
| 
3144.7.9
by Guillermo Gonzalez
 * bzrlib.log.show_roperties don't hide handler errors  | 
601  | 
message:
 | 
| 
4857.4.2
by John Arbash Meinel
 Add a 'make_standard_commit' helper, to remove more code duplication.  | 
602  | 
  add a
 | 
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
603  | 
""",  | 
| 
4857.4.5
by John Arbash Meinel
 We don't need the utf8 option, no test actually wanted to run without it,  | 
604  | 
wt.branch, log.LongLogFormatter)  | 
| 
3144.7.9
by Guillermo Gonzalez
 * bzrlib.log.show_roperties don't hide handler errors  | 
605  | 
|
| 
3976.3.1
by Neil Martinsen-Burrell
 Add custom properties handling to short log format  | 
606  | 
def test_properties_in_short_log(self):  | 
| 
4032.1.2
by John Arbash Meinel
 Track down a few more files that have trailing whitespace.  | 
607  | 
"""Log includes the custom properties returned by the registered  | 
| 
3976.3.1
by Neil Martinsen-Burrell
 Add custom properties handling to short log format  | 
608  | 
        handlers.
 | 
609  | 
        """
 | 
|
| 
4857.4.2
by John Arbash Meinel
 Add a 'make_standard_commit' helper, to remove more code duplication.  | 
610  | 
wt = self.make_standard_commit('test_properties_in_short_log')  | 
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
611  | 
def trivial_custom_prop_handler(revision):  | 
612  | 
return {'test_prop':'test_value'}  | 
|
| 
3976.3.1
by Neil Martinsen-Burrell
 Add custom properties handling to short log format  | 
613  | 
|
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
614  | 
log.properties_handler_registry.register(  | 
615  | 
'trivial_custom_prop_handler',  | 
|
616  | 
trivial_custom_prop_handler)  | 
|
617  | 
self.assertFormatterResult("""\  | 
|
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
618  | 
1 John Doe\t2005-11-22  | 
| 
3976.3.1
by Neil Martinsen-Burrell
 Add custom properties handling to short log format  | 
619  | 
      test_prop: test_value
 | 
| 
4857.4.2
by John Arbash Meinel
 Add a 'make_standard_commit' helper, to remove more code duplication.  | 
620  | 
      add a
 | 
| 
3976.3.1
by Neil Martinsen-Burrell
 Add custom properties handling to short log format  | 
621  | 
|
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
622  | 
""",  | 
623  | 
wt.branch, log.ShortLogFormatter)  | 
|
| 
3976.3.1
by Neil Martinsen-Burrell
 Add custom properties handling to short log format  | 
624  | 
|
| 
3144.7.9
by Guillermo Gonzalez
 * bzrlib.log.show_roperties don't hide handler errors  | 
625  | 
def test_error_in_properties_handler(self):  | 
| 
3943.8.1
by Marius Kruger
 remove all trailing whitespace from bzr source  | 
626  | 
"""Log includes the custom properties returned by the registered  | 
| 
3144.7.9
by Guillermo Gonzalez
 * bzrlib.log.show_roperties don't hide handler errors  | 
627  | 
        handlers.
 | 
628  | 
        """
 | 
|
| 
4857.4.2
by John Arbash Meinel
 Add a 'make_standard_commit' helper, to remove more code duplication.  | 
629  | 
wt = self.make_standard_commit('error_in_properties_handler',  | 
630  | 
revprops={'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,  | 
631  | 
sio = self.make_utf8_encoded_stringio()  | 
| 
3842.2.1
by Vincent Ladeuil
 Cosmetic changes.  | 
632  | 
formatter = log.LongLogFormatter(to_file=sio)  | 
| 
4857.4.2
by John Arbash Meinel
 Add a 'make_standard_commit' helper, to remove more code duplication.  | 
633  | 
def trivial_custom_prop_handler(revision):  | 
634  | 
raise StandardError("a test error")  | 
|
| 
3842.2.1
by Vincent Ladeuil
 Cosmetic changes.  | 
635  | 
|
| 
4857.4.2
by John Arbash Meinel
 Add a 'make_standard_commit' helper, to remove more code duplication.  | 
636  | 
log.properties_handler_registry.register(  | 
637  | 
'trivial_custom_prop_handler',  | 
|
638  | 
trivial_custom_prop_handler)  | 
|
639  | 
self.assertRaises(StandardError, log.show_log, wt.branch, formatter,)  | 
|
| 
3842.2.1
by Vincent Ladeuil
 Cosmetic changes.  | 
640  | 
|
| 
3144.7.13
by Guillermo Gonzalez
 * fixed typo LogFormatter.show_properties in docstring  | 
641  | 
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.  | 
642  | 
wt = self.make_standard_commit('bad_argument',  | 
643  | 
revprops={'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,  | 
644  | 
sio = self.make_utf8_encoded_stringio()  | 
| 
3842.2.1
by Vincent Ladeuil
 Cosmetic changes.  | 
645  | 
formatter = log.LongLogFormatter(to_file=sio)  | 
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
646  | 
def bad_argument_prop_handler(revision):  | 
647  | 
return {'custom_prop_name':revision.properties['a_prop']}  | 
|
648  | 
||
649  | 
log.properties_handler_registry.register(  | 
|
650  | 
'bad_argument_prop_handler',  | 
|
651  | 
bad_argument_prop_handler)  | 
|
652  | 
||
653  | 
self.assertRaises(AttributeError, formatter.show_properties,  | 
|
654  | 
'a revision', '')  | 
|
655  | 
||
656  | 
revision = wt.branch.repository.get_revision(wt.branch.last_revision())  | 
|
657  | 
formatter.show_properties(revision, '')  | 
|
658  | 
self.assertEqualDiff('''custom_prop_name: test_value\n''',  | 
|
659  | 
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.  | 
660  | 
|
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
661  | 
|
| 
4857.4.3
by John Arbash Meinel
 Handle LineLogFormatter  | 
662  | 
class TestLongLogFormatterWithoutMergeRevisions(TestCaseForLogFormatter):  | 
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
663  | 
|
664  | 
def test_long_verbose_log(self):  | 
|
665  | 
"""Verbose log includes changed files  | 
|
| 
4032.1.2
by John Arbash Meinel
 Track down a few more files that have trailing whitespace.  | 
666  | 
|
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
667  | 
        bug #4676
 | 
668  | 
        """
 | 
|
| 
4857.4.2
by John Arbash Meinel
 Add a 'make_standard_commit' helper, to remove more code duplication.  | 
669  | 
wt = self.make_standard_commit('test_long_verbose_log', authors=[])  | 
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
670  | 
self.assertFormatterResult("""\  | 
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
671  | 
------------------------------------------------------------
 | 
672  | 
revno: 1
 | 
|
673  | 
committer: Lorem Ipsum <test@example.com>
 | 
|
| 
4857.4.2
by John Arbash Meinel
 Add a 'make_standard_commit' helper, to remove more code duplication.  | 
674  | 
branch nick: test_long_verbose_log
 | 
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
675  | 
timestamp: Tue 2005-11-22 00:00:00 +0000
 | 
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
676  | 
message:
 | 
677  | 
  add a
 | 
|
678  | 
added:
 | 
|
679  | 
  a
 | 
|
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
680  | 
""",  | 
681  | 
wt.branch, log.LongLogFormatter,  | 
|
682  | 
formatter_kwargs=dict(levels=1),  | 
|
| 
4857.4.5
by John Arbash Meinel
 We don't need the utf8 option, no test actually wanted to run without it,  | 
683  | 
show_log_kwargs=dict(verbose=True))  | 
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
684  | 
|
685  | 
def test_long_verbose_contain_deltas(self):  | 
|
686  | 
wt = self.make_branch_and_tree('parent')  | 
|
687  | 
self.build_tree(['parent/f1', 'parent/f2'])  | 
|
688  | 
wt.add(['f1','f2'])  | 
|
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
689  | 
self.wt_commit(wt, 'first post')  | 
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
690  | 
child_wt = wt.bzrdir.sprout('child').open_workingtree()  | 
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
691  | 
os.unlink('child/f1')  | 
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
692  | 
self.build_tree_contents([('child/f2', 'hello\n')])  | 
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
693  | 
self.wt_commit(child_wt, 'removed f1 and modified f2')  | 
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
694  | 
wt.merge_from_branch(child_wt.branch)  | 
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
695  | 
self.wt_commit(wt, 'merge branch 1')  | 
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
696  | 
self.assertFormatterResult("""\  | 
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
697  | 
------------------------------------------------------------
 | 
| 
4208.2.1
by Ian Clatworthy
 merge indicators in log --long  | 
698  | 
revno: 2 [merge]
 | 
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
699  | 
committer: Joe Foo <joe@foo.com>
 | 
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
700  | 
branch nick: parent
 | 
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
701  | 
timestamp: Tue 2005-11-22 00:00:02 +0000
 | 
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
702  | 
message:
 | 
703  | 
  merge branch 1
 | 
|
704  | 
removed:
 | 
|
705  | 
  f1
 | 
|
706  | 
modified:
 | 
|
707  | 
  f2
 | 
|
708  | 
------------------------------------------------------------
 | 
|
709  | 
revno: 1
 | 
|
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
710  | 
committer: Joe Foo <joe@foo.com>
 | 
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
711  | 
branch nick: parent
 | 
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
712  | 
timestamp: Tue 2005-11-22 00:00:00 +0000
 | 
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
713  | 
message:
 | 
714  | 
  first post
 | 
|
715  | 
added:
 | 
|
716  | 
  f1
 | 
|
717  | 
  f2
 | 
|
718  | 
""",  | 
|
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
719  | 
wt.branch, log.LongLogFormatter,  | 
720  | 
formatter_kwargs=dict(levels=1),  | 
|
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
721  | 
show_log_kwargs=dict(verbose=True))  | 
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
722  | 
|
723  | 
def test_long_trailing_newlines(self):  | 
|
724  | 
wt = self.make_branch_and_tree('.')  | 
|
| 
4955.4.1
by Vincent Ladeuil
 Refactor the function into an helper.  | 
725  | 
b = self.make_commits_with_trailing_newlines(wt)  | 
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
726  | 
self.assertFormatterResult("""\  | 
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
727  | 
------------------------------------------------------------
 | 
728  | 
revno: 3
 | 
|
729  | 
committer: Joe Foo <joe@foo.com>
 | 
|
730  | 
branch nick: test
 | 
|
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
731  | 
timestamp: Tue 2005-11-22 00:00:02 +0000
 | 
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
732  | 
message:
 | 
733  | 
  single line with trailing newline
 | 
|
734  | 
------------------------------------------------------------
 | 
|
735  | 
revno: 2
 | 
|
736  | 
committer: Joe Foo <joe@foo.com>
 | 
|
737  | 
branch nick: test
 | 
|
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
738  | 
timestamp: Tue 2005-11-22 00:00:01 +0000
 | 
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
739  | 
message:
 | 
740  | 
  multiline
 | 
|
741  | 
  log
 | 
|
742  | 
  message
 | 
|
743  | 
------------------------------------------------------------
 | 
|
744  | 
revno: 1
 | 
|
745  | 
committer: Joe Foo <joe@foo.com>
 | 
|
746  | 
branch nick: test
 | 
|
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
747  | 
timestamp: Tue 2005-11-22 00:00:00 +0000
 | 
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
748  | 
message:
 | 
749  | 
  simple log message
 | 
|
750  | 
""",  | 
|
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
751  | 
b, log.LongLogFormatter,  | 
752  | 
formatter_kwargs=dict(levels=1))  | 
|
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
753  | 
|
754  | 
def test_long_author_in_log(self):  | 
|
755  | 
"""Log includes the author name if it's set in  | 
|
756  | 
        the revision properties
 | 
|
757  | 
        """
 | 
|
| 
4857.4.2
by John Arbash Meinel
 Add a 'make_standard_commit' helper, to remove more code duplication.  | 
758  | 
wt = self.make_standard_commit('test_author_log')  | 
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
759  | 
self.assertFormatterResult("""\  | 
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
760  | 
------------------------------------------------------------
 | 
761  | 
revno: 1
 | 
|
762  | 
author: John Doe <jdoe@example.com>
 | 
|
763  | 
committer: Lorem Ipsum <test@example.com>
 | 
|
764  | 
branch nick: test_author_log
 | 
|
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
765  | 
timestamp: Tue 2005-11-22 00:00:00 +0000
 | 
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
766  | 
message:
 | 
| 
4857.4.2
by John Arbash Meinel
 Add a 'make_standard_commit' helper, to remove more code duplication.  | 
767  | 
  add a
 | 
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
768  | 
""",  | 
769  | 
wt.branch, log.LongLogFormatter,  | 
|
770  | 
formatter_kwargs=dict(levels=1))  | 
|
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
771  | 
|
772  | 
def test_long_properties_in_log(self):  | 
|
| 
4032.1.2
by John Arbash Meinel
 Track down a few more files that have trailing whitespace.  | 
773  | 
"""Log includes the custom properties returned by the registered  | 
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
774  | 
        handlers.
 | 
775  | 
        """
 | 
|
| 
4857.4.2
by John Arbash Meinel
 Add a 'make_standard_commit' helper, to remove more code duplication.  | 
776  | 
wt = self.make_standard_commit('test_properties_in_log')  | 
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
777  | 
def trivial_custom_prop_handler(revision):  | 
778  | 
return {'test_prop':'test_value'}  | 
|
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
779  | 
|
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
780  | 
log.properties_handler_registry.register(  | 
781  | 
'trivial_custom_prop_handler',  | 
|
782  | 
trivial_custom_prop_handler)  | 
|
783  | 
self.assertFormatterResult("""\  | 
|
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
784  | 
------------------------------------------------------------
 | 
785  | 
revno: 1
 | 
|
786  | 
test_prop: test_value
 | 
|
787  | 
author: John Doe <jdoe@example.com>
 | 
|
788  | 
committer: Lorem Ipsum <test@example.com>
 | 
|
789  | 
branch nick: test_properties_in_log
 | 
|
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
790  | 
timestamp: Tue 2005-11-22 00:00:00 +0000
 | 
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
791  | 
message:
 | 
| 
4857.4.2
by John Arbash Meinel
 Add a 'make_standard_commit' helper, to remove more code duplication.  | 
792  | 
  add a
 | 
| 
4857.4.1
by John Arbash Meinel
 Start cleaning up test_log.  | 
793  | 
""",  | 
794  | 
wt.branch, log.LongLogFormatter,  | 
|
795  | 
formatter_kwargs=dict(levels=1))  | 
|
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
796  | 
|
797  | 
||
| 
4857.4.3
by John Arbash Meinel
 Handle LineLogFormatter  | 
798  | 
class TestLineLogFormatter(TestCaseForLogFormatter):  | 
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
799  | 
|
| 
1704.2.20
by Martin Pool
 log --line shows revision numbers (Alexander)  | 
800  | 
def test_line_log(self):  | 
801  | 
"""Line log should show revno  | 
|
| 
3943.8.1
by Marius Kruger
 remove all trailing whitespace from bzr source  | 
802  | 
|
| 
1704.2.20
by Martin Pool
 log --line shows revision numbers (Alexander)  | 
803  | 
        bug #5162
 | 
804  | 
        """
 | 
|
| 
4857.4.3
by John Arbash Meinel
 Handle LineLogFormatter  | 
805  | 
wt = self.make_standard_commit('test-line-log',  | 
806  | 
committer='Line-Log-Formatter Tester <test@line.log>',  | 
|
807  | 
authors=[])  | 
|
808  | 
self.assertFormatterResult("""\  | 
|
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
809  | 
1: Line-Log-Formatte... 2005-11-22 add a
 | 
| 
4857.4.3
by John Arbash Meinel
 Handle LineLogFormatter  | 
810  | 
""",  | 
811  | 
wt.branch, log.LineLogFormatter)  | 
|
| 
1756.2.20
by Aaron Bentley
 Optimize log formats that don't show merges  | 
812  | 
|
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
813  | 
def test_trailing_newlines(self):  | 
814  | 
wt = self.make_branch_and_tree('.')  | 
|
| 
4955.4.1
by Vincent Ladeuil
 Refactor the function into an helper.  | 
815  | 
b = self.make_commits_with_trailing_newlines(wt)  | 
| 
4857.4.3
by John Arbash Meinel
 Handle LineLogFormatter  | 
816  | 
self.assertFormatterResult("""\  | 
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
817  | 
3: Joe Foo 2005-11-22 single line with trailing newline
 | 
818  | 
2: Joe Foo 2005-11-22 multiline
 | 
|
819  | 
1: Joe Foo 2005-11-22 simple log message
 | 
|
| 
3842.2.7
by Vincent Ladeuil
 Fixed as per Jonh's review.  | 
820  | 
""",  | 
| 
4857.4.3
by John Arbash Meinel
 Handle LineLogFormatter  | 
821  | 
b, log.LineLogFormatter)  | 
| 
3946.3.2
by Ian Clatworthy
 add tests & NEWS item  | 
822  | 
|
| 
2997.1.1
by Kent Gibson
 Support logging single merge revisions with short and line log formatters.  | 
823  | 
def test_line_log_single_merge_revision(self):  | 
| 
3946.3.2
by Ian Clatworthy
 add tests & NEWS item  | 
824  | 
wt = self._prepare_tree_with_merges()  | 
| 
3842.2.3
by Vincent Ladeuil
 Yet more cleanup and fix test_file_id_f3 bogus test.  | 
825  | 
revspec = revisionspec.RevisionSpec.from_string('1.1.1')  | 
| 
4857.4.3
by John Arbash Meinel
 Handle LineLogFormatter  | 
826  | 
rev = revspec.in_history(wt.branch)  | 
827  | 
self.assertFormatterResult("""\  | 
|
| 
2997.1.1
by Kent Gibson
 Support logging single merge revisions with short and line log formatters.  | 
828  | 
1.1.1: Joe Foo 2005-11-22 rev-merged
 | 
| 
3842.2.7
by Vincent Ladeuil
 Fixed as per Jonh's review.  | 
829  | 
""",  | 
| 
4857.4.3
by John Arbash Meinel
 Handle LineLogFormatter  | 
830  | 
wt.branch, log.LineLogFormatter,  | 
831  | 
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.  | 
832  | 
|
| 
3946.3.2
by Ian Clatworthy
 add tests & NEWS item  | 
833  | 
def test_line_log_with_tags(self):  | 
834  | 
wt = self._prepare_tree_with_merges(with_tags=True)  | 
|
| 
4857.4.3
by John Arbash Meinel
 Handle LineLogFormatter  | 
835  | 
self.assertFormatterResult("""\  | 
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
836  | 
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  | 
837  | 
2: Joe Foo 2005-11-22 [merge] {v0.2} rev-2  | 
| 
3946.3.2
by Ian Clatworthy
 add tests & NEWS item  | 
838  | 
1: Joe Foo 2005-11-22 rev-1
 | 
839  | 
""",  | 
|
| 
4857.4.3
by John Arbash Meinel
 Handle LineLogFormatter  | 
840  | 
wt.branch, log.LineLogFormatter)  | 
841  | 
||
842  | 
||
843  | 
class TestLineLogFormatterWithMergeRevisions(TestCaseForLogFormatter):  | 
|
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
844  | 
|
845  | 
def test_line_merge_revs_log(self):  | 
|
846  | 
"""Line log should show revno  | 
|
| 
4032.1.2
by John Arbash Meinel
 Track down a few more files that have trailing whitespace.  | 
847  | 
|
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
848  | 
        bug #5162
 | 
849  | 
        """
 | 
|
| 
4857.4.3
by John Arbash Meinel
 Handle LineLogFormatter  | 
850  | 
wt = self.make_standard_commit('test-line-log',  | 
851  | 
committer='Line-Log-Formatter Tester <test@line.log>',  | 
|
852  | 
authors=[])  | 
|
853  | 
self.assertFormatterResult("""\  | 
|
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
854  | 
1: Line-Log-Formatte... 2005-11-22 add a
 | 
| 
4857.4.3
by John Arbash Meinel
 Handle LineLogFormatter  | 
855  | 
""",  | 
856  | 
wt.branch, log.LineLogFormatter)  | 
|
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
857  | 
|
858  | 
def test_line_merge_revs_log_single_merge_revision(self):  | 
|
| 
4955.4.19
by Vincent Ladeuil
 Less code duplication.  | 
859  | 
wt = self._prepare_tree_with_merges()  | 
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
860  | 
revspec = revisionspec.RevisionSpec.from_string('1.1.1')  | 
| 
4857.4.3
by John Arbash Meinel
 Handle LineLogFormatter  | 
861  | 
rev = revspec.in_history(wt.branch)  | 
862  | 
self.assertFormatterResult("""\  | 
|
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
863  | 
1.1.1: Joe Foo 2005-11-22 rev-merged
 | 
864  | 
""",  | 
|
| 
4857.4.3
by John Arbash Meinel
 Handle LineLogFormatter  | 
865  | 
wt.branch, log.LineLogFormatter,  | 
866  | 
formatter_kwargs=dict(levels=0),  | 
|
867  | 
show_log_kwargs=dict(start_revision=rev, end_revision=rev))  | 
|
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
868  | 
|
869  | 
def test_line_merge_revs_log_with_merges(self):  | 
|
| 
4955.4.19
by Vincent Ladeuil
 Less code duplication.  | 
870  | 
wt = self._prepare_tree_with_merges()  | 
| 
4857.4.3
by John Arbash Meinel
 Handle LineLogFormatter  | 
871  | 
self.assertFormatterResult("""\  | 
| 
3983.2.1
by Neil Martinsen-Burrell
 add merge indication to the line format  | 
872  | 
2: Joe Foo 2005-11-22 [merge] rev-2
 | 
| 
3947.1.2
by Ian Clatworthy
 formatter tests  | 
873  | 
  1.1.1: Joe Foo 2005-11-22 rev-merged
 | 
874  | 
1: Joe Foo 2005-11-22 rev-1
 | 
|
875  | 
""",  | 
|
| 
4857.4.3
by John Arbash Meinel
 Handle LineLogFormatter  | 
876  | 
wt.branch, log.LineLogFormatter,  | 
877  | 
formatter_kwargs=dict(levels=0))  | 
|
878  | 
||
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
879  | 
|
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
880  | 
class TestGetViewRevisions(tests.TestCaseWithTransport, TestLogMixin):  | 
| 
2466.11.2
by Kent Gibson
 Add tests for deltas in merge revisions  | 
881  | 
|
| 
4955.4.20
by Vincent Ladeuil
 Properly deprecate dead code.  | 
882  | 
def _get_view_revisions(self, *args, **kwargs):  | 
883  | 
return self.applyDeprecated(symbol_versioning.deprecated_in((2, 2, 0)),  | 
|
884  | 
log.get_view_revisions, *args, **kwargs)  | 
|
885  | 
||
| 
1756.2.22
by Aaron Bentley
 Apply review comments  | 
886  | 
def make_tree_with_commits(self):  | 
887  | 
"""Create a tree with well-known revision ids"""  | 
|
| 
1756.2.20
by Aaron Bentley
 Optimize log formats that don't show merges  | 
888  | 
wt = self.make_branch_and_tree('tree1')  | 
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
889  | 
self.wt_commit(wt, 'commit one', rev_id='1')  | 
890  | 
self.wt_commit(wt, 'commit two', rev_id='2')  | 
|
891  | 
self.wt_commit(wt, 'commit three', rev_id='3')  | 
|
| 
1756.2.20
by Aaron Bentley
 Optimize log formats that don't show merges  | 
892  | 
mainline_revs = [None, '1', '2', '3']  | 
| 
1756.2.22
by Aaron Bentley
 Apply review comments  | 
893  | 
rev_nos = {'1': 1, '2': 2, '3': 3}  | 
894  | 
return mainline_revs, rev_nos, wt  | 
|
895  | 
||
896  | 
def make_tree_with_merges(self):  | 
|
897  | 
"""Create a tree with well-known revision ids and a merge"""  | 
|
898  | 
mainline_revs, rev_nos, wt = self.make_tree_with_commits()  | 
|
| 
1756.2.20
by Aaron Bentley
 Optimize log formats that don't show merges  | 
899  | 
tree2 = wt.bzrdir.sprout('tree2').open_workingtree()  | 
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
900  | 
self.wt_commit(tree2, 'four-a', rev_id='4a')  | 
| 
1979.2.1
by Robert Collins
 (robertc) adds a convenience method "merge_from_branch" to WorkingTree.  | 
901  | 
wt.merge_from_branch(tree2.branch)  | 
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
902  | 
self.wt_commit(wt, 'four-b', rev_id='4b')  | 
| 
1756.2.20
by Aaron Bentley
 Optimize log formats that don't show merges  | 
903  | 
mainline_revs.append('4b')  | 
| 
1756.2.22
by Aaron Bentley
 Apply review comments  | 
904  | 
rev_nos['4b'] = 4  | 
| 
1988.4.2
by Robert Collins
 ``bzr log`` Now shows dotted-decimal revision numbers for all revisions,  | 
905  | 
        # 4a: 3.1.1
 | 
| 
1756.2.22
by Aaron Bentley
 Apply review comments  | 
906  | 
return mainline_revs, rev_nos, wt  | 
907  | 
||
| 
4615.1.2
by John Arbash Meinel
 clarify the test a bit by using BranchBuilder.  | 
908  | 
def make_branch_with_many_merges(self):  | 
| 
1756.2.24
by Aaron Bentley
 Forward sorting shows merges under mainline revision  | 
909  | 
"""Create a tree with well-known revision ids"""  | 
| 
4615.1.2
by John Arbash Meinel
 clarify the test a bit by using BranchBuilder.  | 
910  | 
builder = self.make_branch_builder('tree1')  | 
911  | 
builder.start_series()  | 
|
912  | 
builder.build_snapshot('1', None, [  | 
|
913  | 
('add', ('', 'TREE_ROOT', 'directory', '')),  | 
|
914  | 
('add', ('f', 'f-id', 'file', '1\n'))])  | 
|
915  | 
builder.build_snapshot('2', ['1'], [])  | 
|
916  | 
builder.build_snapshot('3a', ['2'], [  | 
|
917  | 
('modify', ('f-id', '1\n2\n3a\n'))])  | 
|
918  | 
builder.build_snapshot('3b', ['2', '3a'], [  | 
|
919  | 
('modify', ('f-id', '1\n2\n3a\n'))])  | 
|
920  | 
builder.build_snapshot('3c', ['2', '3b'], [  | 
|
921  | 
('modify', ('f-id', '1\n2\n3a\n'))])  | 
|
922  | 
builder.build_snapshot('4a', ['3b'], [])  | 
|
923  | 
builder.build_snapshot('4b', ['3c', '4a'], [])  | 
|
924  | 
builder.finish_series()  | 
|
925  | 
||
926  | 
        # 1
 | 
|
927  | 
        # |
 | 
|
928  | 
        # 2-.
 | 
|
929  | 
        # |\ \
 | 
|
930  | 
        # | | 3a
 | 
|
931  | 
        # | |/
 | 
|
932  | 
        # | 3b
 | 
|
933  | 
        # |/|
 | 
|
934  | 
        # 3c4a
 | 
|
935  | 
        # |/
 | 
|
936  | 
        # 4b
 | 
|
| 
3842.2.5
by Vincent Ladeuil
 Better fix for bug #300055.  | 
937  | 
|
| 
1756.2.24
by Aaron Bentley
 Forward sorting shows merges under mainline revision  | 
938  | 
mainline_revs = [None, '1', '2', '3c', '4b']  | 
| 
1988.4.2
by Robert Collins
 ``bzr log`` Now shows dotted-decimal revision numbers for all revisions,  | 
939  | 
rev_nos = {'1':1, '2':2, '3c': 3, '4b':4}  | 
940  | 
full_rev_nos_for_reference = {  | 
|
941  | 
'1': '1',  | 
|
942  | 
'2': '2',  | 
|
| 
3170.3.4
by John Arbash Meinel
 Update the tests for the new revision numbering.  | 
943  | 
'3a': '2.1.1', #first commit tree 3  | 
944  | 
'3b': '2.2.1', # first commit tree 2  | 
|
| 
1988.4.2
by Robert Collins
 ``bzr log`` Now shows dotted-decimal revision numbers for all revisions,  | 
945  | 
'3c': '3', #merges 3b to main  | 
| 
3170.3.4
by John Arbash Meinel
 Update the tests for the new revision numbering.  | 
946  | 
'4a': '2.2.2', # second commit tree 2  | 
| 
1988.4.2
by Robert Collins
 ``bzr log`` Now shows dotted-decimal revision numbers for all revisions,  | 
947  | 
'4b': '4', # merges 4a to main  | 
948  | 
            }
 | 
|
| 
4615.1.2
by John Arbash Meinel
 clarify the test a bit by using BranchBuilder.  | 
949  | 
return mainline_revs, rev_nos, builder.get_branch()  | 
| 
1756.2.24
by Aaron Bentley
 Forward sorting shows merges under mainline revision  | 
950  | 
|
| 
1756.2.22
by Aaron Bentley
 Apply review comments  | 
951  | 
def test_get_view_revisions_forward(self):  | 
952  | 
"""Test the get_view_revisions method"""  | 
|
953  | 
mainline_revs, rev_nos, wt = self.make_tree_with_commits()  | 
|
| 
3287.6.1
by Robert Collins
 * ``VersionedFile.get_graph`` is deprecated, with no replacement method.  | 
954  | 
wt.lock_read()  | 
955  | 
self.addCleanup(wt.unlock)  | 
|
| 
4955.4.20
by Vincent Ladeuil
 Properly deprecate dead code.  | 
956  | 
revisions = list(self._get_view_revisions(  | 
| 
3842.2.1
by Vincent Ladeuil
 Cosmetic changes.  | 
957  | 
mainline_revs, rev_nos, wt.branch, 'forward'))  | 
| 
1988.4.2
by Robert Collins
 ``bzr log`` Now shows dotted-decimal revision numbers for all revisions,  | 
958  | 
self.assertEqual([('1', '1', 0), ('2', '2', 0), ('3', '3', 0)],  | 
| 
3842.2.2
by Vincent Ladeuil
 Reproduce bug #300055.  | 
959  | 
revisions)  | 
| 
4955.4.20
by Vincent Ladeuil
 Properly deprecate dead code.  | 
960  | 
revisions2 = list(self._get_view_revisions(  | 
| 
3842.2.2
by Vincent Ladeuil
 Reproduce bug #300055.  | 
961  | 
mainline_revs, rev_nos, wt.branch, 'forward',  | 
962  | 
include_merges=False))  | 
|
| 
1756.2.22
by Aaron Bentley
 Apply review comments  | 
963  | 
self.assertEqual(revisions, revisions2)  | 
964  | 
||
965  | 
def test_get_view_revisions_reverse(self):  | 
|
966  | 
"""Test the get_view_revisions with reverse"""  | 
|
967  | 
mainline_revs, rev_nos, wt = self.make_tree_with_commits()  | 
|
| 
3287.6.1
by Robert Collins
 * ``VersionedFile.get_graph`` is deprecated, with no replacement method.  | 
968  | 
wt.lock_read()  | 
969  | 
self.addCleanup(wt.unlock)  | 
|
| 
4955.4.20
by Vincent Ladeuil
 Properly deprecate dead code.  | 
970  | 
revisions = list(self._get_view_revisions(  | 
| 
3842.2.1
by Vincent Ladeuil
 Cosmetic changes.  | 
971  | 
mainline_revs, rev_nos, wt.branch, 'reverse'))  | 
| 
1988.4.2
by Robert Collins
 ``bzr log`` Now shows dotted-decimal revision numbers for all revisions,  | 
972  | 
self.assertEqual([('3', '3', 0), ('2', '2', 0), ('1', '1', 0), ],  | 
| 
3842.2.2
by Vincent Ladeuil
 Reproduce bug #300055.  | 
973  | 
revisions)  | 
| 
4955.4.20
by Vincent Ladeuil
 Properly deprecate dead code.  | 
974  | 
revisions2 = list(self._get_view_revisions(  | 
| 
3842.2.1
by Vincent Ladeuil
 Cosmetic changes.  | 
975  | 
mainline_revs, rev_nos, wt.branch, 'reverse',  | 
976  | 
include_merges=False))  | 
|
| 
1756.2.22
by Aaron Bentley
 Apply review comments  | 
977  | 
self.assertEqual(revisions, revisions2)  | 
978  | 
||
979  | 
def test_get_view_revisions_merge(self):  | 
|
980  | 
"""Test get_view_revisions when there are merges"""  | 
|
981  | 
mainline_revs, rev_nos, wt = self.make_tree_with_merges()  | 
|
| 
3287.6.1
by Robert Collins
 * ``VersionedFile.get_graph`` is deprecated, with no replacement method.  | 
982  | 
wt.lock_read()  | 
983  | 
self.addCleanup(wt.unlock)  | 
|
| 
4955.4.20
by Vincent Ladeuil
 Properly deprecate dead code.  | 
984  | 
revisions = list(self._get_view_revisions(  | 
| 
3842.2.1
by Vincent Ladeuil
 Cosmetic changes.  | 
985  | 
mainline_revs, rev_nos, wt.branch, 'forward'))  | 
| 
1988.4.2
by Robert Collins
 ``bzr log`` Now shows dotted-decimal revision numbers for all revisions,  | 
986  | 
self.assertEqual([('1', '1', 0), ('2', '2', 0), ('3', '3', 0),  | 
| 
3842.2.2
by Vincent Ladeuil
 Reproduce bug #300055.  | 
987  | 
('4b', '4', 0), ('4a', '3.1.1', 1)],  | 
988  | 
revisions)  | 
|
| 
4955.4.20
by Vincent Ladeuil
 Properly deprecate dead code.  | 
989  | 
revisions = list(self._get_view_revisions(  | 
| 
3842.2.1
by Vincent Ladeuil
 Cosmetic changes.  | 
990  | 
mainline_revs, rev_nos, wt.branch, 'forward',  | 
991  | 
include_merges=False))  | 
|
| 
1988.4.2
by Robert Collins
 ``bzr log`` Now shows dotted-decimal revision numbers for all revisions,  | 
992  | 
self.assertEqual([('1', '1', 0), ('2', '2', 0), ('3', '3', 0),  | 
| 
3842.2.2
by Vincent Ladeuil
 Reproduce bug #300055.  | 
993  | 
('4b', '4', 0)],  | 
994  | 
revisions)  | 
|
| 
1756.2.24
by Aaron Bentley
 Forward sorting shows merges under mainline revision  | 
995  | 
|
996  | 
def test_get_view_revisions_merge_reverse(self):  | 
|
997  | 
"""Test get_view_revisions in reverse when there are merges"""  | 
|
998  | 
mainline_revs, rev_nos, wt = self.make_tree_with_merges()  | 
|
| 
3287.6.1
by Robert Collins
 * ``VersionedFile.get_graph`` is deprecated, with no replacement method.  | 
999  | 
wt.lock_read()  | 
1000  | 
self.addCleanup(wt.unlock)  | 
|
| 
4955.4.20
by Vincent Ladeuil
 Properly deprecate dead code.  | 
1001  | 
revisions = list(self._get_view_revisions(  | 
| 
3842.2.1
by Vincent Ladeuil
 Cosmetic changes.  | 
1002  | 
mainline_revs, rev_nos, wt.branch, 'reverse'))  | 
| 
1988.4.2
by Robert Collins
 ``bzr log`` Now shows dotted-decimal revision numbers for all revisions,  | 
1003  | 
self.assertEqual([('4b', '4', 0), ('4a', '3.1.1', 1),  | 
| 
3842.2.2
by Vincent Ladeuil
 Reproduce bug #300055.  | 
1004  | 
('3', '3', 0), ('2', '2', 0), ('1', '1', 0)],  | 
1005  | 
revisions)  | 
|
| 
4955.4.20
by Vincent Ladeuil
 Properly deprecate dead code.  | 
1006  | 
revisions = list(self._get_view_revisions(  | 
| 
3842.2.1
by Vincent Ladeuil
 Cosmetic changes.  | 
1007  | 
mainline_revs, rev_nos, wt.branch, 'reverse',  | 
1008  | 
include_merges=False))  | 
|
| 
1988.4.2
by Robert Collins
 ``bzr log`` Now shows dotted-decimal revision numbers for all revisions,  | 
1009  | 
self.assertEqual([('4b', '4', 0), ('3', '3', 0), ('2', '2', 0),  | 
| 
3842.2.2
by Vincent Ladeuil
 Reproduce bug #300055.  | 
1010  | 
('1', '1', 0)],  | 
1011  | 
revisions)  | 
|
| 
1756.2.24
by Aaron Bentley
 Forward sorting shows merges under mainline revision  | 
1012  | 
|
1013  | 
def test_get_view_revisions_merge2(self):  | 
|
1014  | 
"""Test get_view_revisions when there are merges"""  | 
|
| 
4615.1.2
by John Arbash Meinel
 clarify the test a bit by using BranchBuilder.  | 
1015  | 
mainline_revs, rev_nos, b = self.make_branch_with_many_merges()  | 
1016  | 
b.lock_read()  | 
|
1017  | 
self.addCleanup(b.unlock)  | 
|
| 
4955.4.20
by Vincent Ladeuil
 Properly deprecate dead code.  | 
1018  | 
revisions = list(self._get_view_revisions(  | 
| 
4615.1.2
by John Arbash Meinel
 clarify the test a bit by using BranchBuilder.  | 
1019  | 
mainline_revs, rev_nos, b, 'forward'))  | 
| 
1988.4.2
by Robert Collins
 ``bzr log`` Now shows dotted-decimal revision numbers for all revisions,  | 
1020  | 
expected = [('1', '1', 0), ('2', '2', 0), ('3c', '3', 0),  | 
| 
4615.1.3
by John Arbash Meinel
 Since the merge depth changed, it causes log to change slightly as well.  | 
1021  | 
('3b', '2.2.1', 1), ('3a', '2.1.1', 2), ('4b', '4', 0),  | 
| 
3842.2.2
by Vincent Ladeuil
 Reproduce bug #300055.  | 
1022  | 
('4a', '2.2.2', 1)]  | 
| 
1988.4.2
by Robert Collins
 ``bzr log`` Now shows dotted-decimal revision numbers for all revisions,  | 
1023  | 
self.assertEqual(expected, revisions)  | 
| 
4955.4.20
by Vincent Ladeuil
 Properly deprecate dead code.  | 
1024  | 
revisions = list(self._get_view_revisions(  | 
| 
4615.1.2
by John Arbash Meinel
 clarify the test a bit by using BranchBuilder.  | 
1025  | 
mainline_revs, rev_nos, b, 'forward',  | 
| 
3842.2.1
by Vincent Ladeuil
 Cosmetic changes.  | 
1026  | 
include_merges=False))  | 
| 
1988.4.2
by Robert Collins
 ``bzr log`` Now shows dotted-decimal revision numbers for all revisions,  | 
1027  | 
self.assertEqual([('1', '1', 0), ('2', '2', 0), ('3c', '3', 0),  | 
| 
3842.2.2
by Vincent Ladeuil
 Reproduce bug #300055.  | 
1028  | 
('4b', '4', 0)],  | 
1029  | 
revisions)  | 
|
| 
2359.1.6
by John Arbash Meinel
 Create a helper tree which has a semi-interesting history.  | 
1030  | 
|
| 
3842.2.5
by Vincent Ladeuil
 Better fix for bug #300055.  | 
1031  | 
def test_file_id_for_range(self):  | 
| 
4615.1.2
by John Arbash Meinel
 clarify the test a bit by using BranchBuilder.  | 
1032  | 
mainline_revs, rev_nos, b = self.make_branch_with_many_merges()  | 
1033  | 
b.lock_read()  | 
|
1034  | 
self.addCleanup(b.unlock)  | 
|
| 
3842.2.5
by Vincent Ladeuil
 Better fix for bug #300055.  | 
1035  | 
|
1036  | 
def rev_from_rev_id(revid, branch):  | 
|
1037  | 
revspec = revisionspec.RevisionSpec.from_string('revid:%s' % revid)  | 
|
1038  | 
return revspec.in_history(branch)  | 
|
1039  | 
||
1040  | 
def view_revs(start_rev, end_rev, file_id, direction):  | 
|
| 
4955.4.14
by Vincent Ladeuil
 Properly deprecate log.calculate_view_revisions.  | 
1041  | 
revs = self.applyDeprecated(  | 
1042  | 
symbol_versioning.deprecated_in((2, 2, 0)),  | 
|
1043  | 
log.calculate_view_revisions,  | 
|
| 
4615.1.2
by John Arbash Meinel
 clarify the test a bit by using BranchBuilder.  | 
1044  | 
b,  | 
| 
3842.2.5
by Vincent Ladeuil
 Better fix for bug #300055.  | 
1045  | 
start_rev, # start_revision  | 
1046  | 
end_rev, # end_revision  | 
|
1047  | 
direction, # direction  | 
|
1048  | 
file_id, # specific_fileid  | 
|
1049  | 
True, # generate_merge_revisions  | 
|
1050  | 
                )
 | 
|
1051  | 
return revs  | 
|
1052  | 
||
| 
4615.1.2
by John Arbash Meinel
 clarify the test a bit by using BranchBuilder.  | 
1053  | 
rev_3a = rev_from_rev_id('3a', b)  | 
1054  | 
rev_4b = rev_from_rev_id('4b', b)  | 
|
| 
4955.5.3
by Vincent Ladeuil
 Cleanup.  | 
1055  | 
self.assertEqual([('3c', '3', 0), ('3b', '2.2.1', 1),  | 
1056  | 
('3a', '2.1.1', 2)],  | 
|
| 
3842.2.5
by Vincent Ladeuil
 Better fix for bug #300055.  | 
1057  | 
view_revs(rev_3a, rev_4b, 'f-id', 'reverse'))  | 
| 
3936.3.30
by Ian Clatworthy
 use iter_merge_sorted_revisions() with stop_range feature  | 
1058  | 
        # Note: 3c still appears before 3a here because of depth-based sorting
 | 
| 
4955.5.3
by Vincent Ladeuil
 Cleanup.  | 
1059  | 
self.assertEqual([('3c', '3', 0), ('3b', '2.2.1', 1),  | 
1060  | 
('3a', '2.1.1', 2)],  | 
|
| 
3842.2.5
by Vincent Ladeuil
 Better fix for bug #300055.  | 
1061  | 
view_revs(rev_3a, rev_4b, 'f-id', 'forward'))  | 
1062  | 
||
1063  | 
||
| 
3842.2.1
by Vincent Ladeuil
 Cosmetic changes.  | 
1064  | 
class TestGetRevisionsTouchingFileID(tests.TestCaseWithTransport):  | 
| 
2359.1.6
by John Arbash Meinel
 Create a helper tree which has a semi-interesting history.  | 
1065  | 
|
| 
4955.4.20
by Vincent Ladeuil
 Properly deprecate dead code.  | 
1066  | 
def get_view_revisions(self, *args):  | 
1067  | 
return self.applyDeprecated(symbol_versioning.deprecated_in((2, 2, 0)),  | 
|
1068  | 
log.get_view_revisions, *args)  | 
|
1069  | 
||
| 
2359.1.6
by John Arbash Meinel
 Create a helper tree which has a semi-interesting history.  | 
1070  | 
def create_tree_with_single_merge(self):  | 
1071  | 
"""Create a branch with a moderate layout.  | 
|
1072  | 
||
1073  | 
        The revision graph looks like:
 | 
|
1074  | 
||
1075  | 
           A
 | 
|
1076  | 
           |\
 | 
|
1077  | 
           B C
 | 
|
1078  | 
           |/
 | 
|
1079  | 
           D
 | 
|
1080  | 
||
1081  | 
        In this graph, A introduced files f1 and f2 and f3.
 | 
|
1082  | 
        B modifies f1 and f3, and C modifies f2 and f3.
 | 
|
1083  | 
        D merges the changes from B and C and resolves the conflict for f3.
 | 
|
1084  | 
        """
 | 
|
1085  | 
        # TODO: jam 20070218 This seems like it could really be done
 | 
|
1086  | 
        #       with make_branch_and_memory_tree() if we could just
 | 
|
1087  | 
        #       create the content of those files.
 | 
|
1088  | 
        # TODO: jam 20070218 Another alternative is that we would really
 | 
|
1089  | 
        #       like to only create this tree 1 time for all tests that
 | 
|
1090  | 
        #       use it. Since 'log' only uses the tree in a readonly
 | 
|
1091  | 
        #       fashion, it seems a shame to regenerate an identical
 | 
|
1092  | 
        #       tree for each test.
 | 
|
| 
4955.4.21
by Vincent Ladeuil
 Mention an idea about memory tree re-use.  | 
1093  | 
        # TODO: vila 20100122 One way to address the shame above will be to
 | 
1094  | 
        #       create a memory tree during test parametrization and give a
 | 
|
1095  | 
        #       *copy* of this tree to each test. Copying a memory tree ought
 | 
|
1096  | 
        #       to be cheap, at least cheaper than creating them with such
 | 
|
1097  | 
        #       complex setups.
 | 
|
| 
2359.1.6
by John Arbash Meinel
 Create a helper tree which has a semi-interesting history.  | 
1098  | 
tree = self.make_branch_and_tree('tree')  | 
1099  | 
tree.lock_write()  | 
|
1100  | 
self.addCleanup(tree.unlock)  | 
|
1101  | 
||
1102  | 
self.build_tree_contents([('tree/f1', 'A\n'),  | 
|
1103  | 
('tree/f2', 'A\n'),  | 
|
1104  | 
('tree/f3', 'A\n'),  | 
|
1105  | 
                                 ])
 | 
|
1106  | 
tree.add(['f1', 'f2', 'f3'], ['f1-id', 'f2-id', 'f3-id'])  | 
|
1107  | 
tree.commit('A', rev_id='A')  | 
|
1108  | 
||
1109  | 
self.build_tree_contents([('tree/f2', 'A\nC\n'),  | 
|
1110  | 
('tree/f3', 'A\nC\n'),  | 
|
1111  | 
                                 ])
 | 
|
1112  | 
tree.commit('C', rev_id='C')  | 
|
1113  | 
        # Revert back to A to build the other history.
 | 
|
1114  | 
tree.set_last_revision('A')  | 
|
1115  | 
tree.branch.set_last_revision_info(1, 'A')  | 
|
1116  | 
self.build_tree_contents([('tree/f1', 'A\nB\n'),  | 
|
1117  | 
('tree/f2', 'A\n'),  | 
|
1118  | 
('tree/f3', 'A\nB\n'),  | 
|
1119  | 
                                 ])
 | 
|
1120  | 
tree.commit('B', rev_id='B')  | 
|
1121  | 
tree.set_parent_ids(['B', 'C'])  | 
|
1122  | 
self.build_tree_contents([('tree/f1', 'A\nB\n'),  | 
|
1123  | 
('tree/f2', 'A\nC\n'),  | 
|
1124  | 
('tree/f3', 'A\nB\nC\n'),  | 
|
1125  | 
                                 ])
 | 
|
1126  | 
tree.commit('D', rev_id='D')  | 
|
1127  | 
||
1128  | 
        # Switch to a read lock for this tree.
 | 
|
| 
3842.2.5
by Vincent Ladeuil
 Better fix for bug #300055.  | 
1129  | 
        # We still have an addCleanup(tree.unlock) pending
 | 
| 
2359.1.6
by John Arbash Meinel
 Create a helper tree which has a semi-interesting history.  | 
1130  | 
tree.unlock()  | 
1131  | 
tree.lock_read()  | 
|
1132  | 
return tree  | 
|
1133  | 
||
| 
3842.2.3
by Vincent Ladeuil
 Yet more cleanup and fix test_file_id_f3 bogus test.  | 
1134  | 
def check_delta(self, delta, **kw):  | 
1135  | 
"""Check the filenames touched by a delta are as expected.  | 
|
1136  | 
||
1137  | 
        Caller only have to pass in the list of files for each part, all
 | 
|
1138  | 
        unspecified parts are considered empty (and checked as such).
 | 
|
1139  | 
        """
 | 
|
1140  | 
for n in 'added', 'removed', 'renamed', 'modified', 'unchanged':  | 
|
1141  | 
            # By default we expect an empty list
 | 
|
1142  | 
expected = kw.get(n, [])  | 
|
1143  | 
            # strip out only the path components
 | 
|
1144  | 
got = [x[0] for x in getattr(delta, n)]  | 
|
| 
3842.2.7
by Vincent Ladeuil
 Fixed as per Jonh's review.  | 
1145  | 
self.assertEqual(expected, got)  | 
| 
3842.2.3
by Vincent Ladeuil
 Yet more cleanup and fix test_file_id_f3 bogus test.  | 
1146  | 
|
| 
2359.1.6
by John Arbash Meinel
 Create a helper tree which has a semi-interesting history.  | 
1147  | 
def test_tree_with_single_merge(self):  | 
1148  | 
"""Make sure the tree layout is correct."""  | 
|
1149  | 
tree = self.create_tree_with_single_merge()  | 
|
1150  | 
rev_A_tree = tree.branch.repository.revision_tree('A')  | 
|
1151  | 
rev_B_tree = tree.branch.repository.revision_tree('B')  | 
|
1152  | 
rev_C_tree = tree.branch.repository.revision_tree('C')  | 
|
1153  | 
rev_D_tree = tree.branch.repository.revision_tree('D')  | 
|
| 
3842.2.3
by Vincent Ladeuil
 Yet more cleanup and fix test_file_id_f3 bogus test.  | 
1154  | 
|
1155  | 
self.check_delta(rev_B_tree.changes_from(rev_A_tree),  | 
|
1156  | 
modified=['f1', 'f3'])  | 
|
1157  | 
||
1158  | 
self.check_delta(rev_C_tree.changes_from(rev_A_tree),  | 
|
1159  | 
modified=['f2', 'f3'])  | 
|
1160  | 
||
1161  | 
self.check_delta(rev_D_tree.changes_from(rev_B_tree),  | 
|
1162  | 
modified=['f2', 'f3'])  | 
|
1163  | 
||
1164  | 
self.check_delta(rev_D_tree.changes_from(rev_C_tree),  | 
|
1165  | 
modified=['f1', 'f3'])  | 
|
| 
2359.1.6
by John Arbash Meinel
 Create a helper tree which has a semi-interesting history.  | 
1166  | 
|
| 
2359.1.7
by John Arbash Meinel
 Create a direct test for _get_revisions_touching_file_id  | 
1167  | 
def assertAllRevisionsForFileID(self, tree, file_id, revisions):  | 
| 
3842.2.1
by Vincent Ladeuil
 Cosmetic changes.  | 
1168  | 
"""Ensure _filter_revisions_touching_file_id returns the right values.  | 
| 
2359.1.7
by John Arbash Meinel
 Create a direct test for _get_revisions_touching_file_id  | 
1169  | 
|
| 
2466.12.1
by Kent Gibson
 Fix ``bzr log -r`` to support selecting merge revisions.  | 
1170  | 
        Get the return value from _filter_revisions_touching_file_id and make
 | 
| 
2359.1.7
by John Arbash Meinel
 Create a direct test for _get_revisions_touching_file_id  | 
1171  | 
        sure they are correct.
 | 
1172  | 
        """
 | 
|
| 
3842.2.3
by Vincent Ladeuil
 Yet more cleanup and fix test_file_id_f3 bogus test.  | 
1173  | 
        # The api for _filter_revisions_touching_file_id is a little crazy.
 | 
| 
2359.1.7
by John Arbash Meinel
 Create a direct test for _get_revisions_touching_file_id  | 
1174  | 
        # So we do the setup here.
 | 
1175  | 
mainline = tree.branch.revision_history()  | 
|
1176  | 
mainline.insert(0, None)  | 
|
1177  | 
revnos = dict((rev, idx+1) for idx, rev in enumerate(mainline))  | 
|
| 
4955.4.20
by Vincent Ladeuil
 Properly deprecate dead code.  | 
1178  | 
view_revs_iter = self.get_view_revisions(  | 
1179  | 
mainline, revnos, tree.branch, 'reverse', True)  | 
|
| 
2466.12.1
by Kent Gibson
 Fix ``bzr log -r`` to support selecting merge revisions.  | 
1180  | 
actual_revs = log._filter_revisions_touching_file_id(  | 
| 
4955.4.20
by Vincent Ladeuil
 Properly deprecate dead code.  | 
1181  | 
tree.branch, file_id, list(view_revs_iter))  | 
| 
2359.1.7
by John Arbash Meinel
 Create a direct test for _get_revisions_touching_file_id  | 
1182  | 
self.assertEqual(revisions, [r for r, revno, depth in actual_revs])  | 
1183  | 
||
1184  | 
def test_file_id_f1(self):  | 
|
1185  | 
tree = self.create_tree_with_single_merge()  | 
|
1186  | 
        # f1 should be marked as modified by revisions A and B
 | 
|
1187  | 
self.assertAllRevisionsForFileID(tree, 'f1-id', ['B', 'A'])  | 
|
1188  | 
||
1189  | 
def test_file_id_f2(self):  | 
|
1190  | 
tree = self.create_tree_with_single_merge()  | 
|
1191  | 
        # f2 should be marked as modified by revisions A, C, and D
 | 
|
1192  | 
        # because D merged the changes from C.
 | 
|
1193  | 
self.assertAllRevisionsForFileID(tree, 'f2-id', ['D', 'C', 'A'])  | 
|
1194  | 
||
1195  | 
def test_file_id_f3(self):  | 
|
1196  | 
tree = self.create_tree_with_single_merge()  | 
|
1197  | 
        # f3 should be marked as modified by revisions A, B, C, and D
 | 
|
| 
3842.2.3
by Vincent Ladeuil
 Yet more cleanup and fix test_file_id_f3 bogus test.  | 
1198  | 
self.assertAllRevisionsForFileID(tree, 'f3-id', ['D', 'C', 'B', 'A'])  | 
| 
1551.17.2
by Aaron Bentley
 Stop showing deltas in pull -v output  | 
1199  | 
|
| 
3373.2.1
by John Arbash Meinel
 Fix bug #209948, properly skip over ghosts when displaying the changes for a single file.  | 
1200  | 
def test_file_id_with_ghosts(self):  | 
1201  | 
        # This is testing bug #209948, where having a ghost would cause
 | 
|
1202  | 
        # _filter_revisions_touching_file_id() to fail.
 | 
|
1203  | 
tree = self.create_tree_with_single_merge()  | 
|
1204  | 
        # We need to add a revision, so switch back to a write-locked tree
 | 
|
| 
3842.2.3
by Vincent Ladeuil
 Yet more cleanup and fix test_file_id_f3 bogus test.  | 
1205  | 
        # (still a single addCleanup(tree.unlock) pending).
 | 
| 
3373.2.1
by John Arbash Meinel
 Fix bug #209948, properly skip over ghosts when displaying the changes for a single file.  | 
1206  | 
tree.unlock()  | 
1207  | 
tree.lock_write()  | 
|
1208  | 
first_parent = tree.last_revision()  | 
|
1209  | 
tree.set_parent_ids([first_parent, 'ghost-revision-id'])  | 
|
1210  | 
self.build_tree_contents([('tree/f1', 'A\nB\nXX\n')])  | 
|
1211  | 
tree.commit('commit with a ghost', rev_id='XX')  | 
|
1212  | 
self.assertAllRevisionsForFileID(tree, 'f1-id', ['XX', 'B', 'A'])  | 
|
1213  | 
self.assertAllRevisionsForFileID(tree, 'f2-id', ['D', 'C', 'A'])  | 
|
1214  | 
||
| 
4183.3.1
by Vincent Ladeuil
 Fix bug #346431 by allowing log._filter_revisions_touching_file_id to be  | 
1215  | 
def test_unknown_file_id(self):  | 
1216  | 
tree = self.create_tree_with_single_merge()  | 
|
1217  | 
self.assertAllRevisionsForFileID(tree, 'unknown', [])  | 
|
1218  | 
||
1219  | 
def test_empty_branch_unknown_file_id(self):  | 
|
1220  | 
tree = self.make_branch_and_tree('tree')  | 
|
1221  | 
self.assertAllRevisionsForFileID(tree, 'unknown', [])  | 
|
1222  | 
||
| 
1551.17.2
by Aaron Bentley
 Stop showing deltas in pull -v output  | 
1223  | 
|
| 
3842.2.1
by Vincent Ladeuil
 Cosmetic changes.  | 
1224  | 
class TestShowChangedRevisions(tests.TestCaseWithTransport):  | 
| 
1551.17.2
by Aaron Bentley
 Stop showing deltas in pull -v output  | 
1225  | 
|
1226  | 
def test_show_changed_revisions_verbose(self):  | 
|
1227  | 
tree = self.make_branch_and_tree('tree_a')  | 
|
1228  | 
self.build_tree(['tree_a/foo'])  | 
|
1229  | 
tree.add('foo')  | 
|
1230  | 
tree.commit('bar', rev_id='bar-id')  | 
|
| 
2717.1.1
by Lukáš Lalinsky
 Use UTF-8 encoded StringIO for log tests to avoid failures on non-ASCII committer names.  | 
1231  | 
s = self.make_utf8_encoded_stringio()  | 
| 
1551.17.2
by Aaron Bentley
 Stop showing deltas in pull -v output  | 
1232  | 
log.show_changed_revisions(tree.branch, [], ['bar-id'], s)  | 
1233  | 
self.assertContainsRe(s.getvalue(), 'bar')  | 
|
1234  | 
self.assertNotContainsRe(s.getvalue(), 'foo')  | 
|
| 
2671.5.8
by Lukáš Lalinsky
 Add tests for LogFormatter.short_committer and LogFormatter.short_author.  | 
1235  | 
|
1236  | 
||
| 
3842.2.1
by Vincent Ladeuil
 Cosmetic changes.  | 
1237  | 
class TestLogFormatter(tests.TestCase):  | 
| 
2671.5.8
by Lukáš Lalinsky
 Add tests for LogFormatter.short_committer and LogFormatter.short_author.  | 
1238  | 
|
| 
4955.4.15
by Vincent Ladeuil
 Remove duplicated code.  | 
1239  | 
def setUp(self):  | 
1240  | 
super(TestLogFormatter, self).setUp()  | 
|
1241  | 
self.rev = revision.Revision('a-id')  | 
|
1242  | 
self.lf = log.LogFormatter(None)  | 
|
1243  | 
||
| 
2671.5.8
by Lukáš Lalinsky
 Add tests for LogFormatter.short_committer and LogFormatter.short_author.  | 
1244  | 
def test_short_committer(self):  | 
| 
4955.4.15
by Vincent Ladeuil
 Remove duplicated code.  | 
1245  | 
def assertCommitter(expected, committer):  | 
1246  | 
self.rev.committer = committer  | 
|
1247  | 
self.assertEqual(expected, self.lf.short_committer(self.rev))  | 
|
1248  | 
||
1249  | 
assertCommitter('John Doe', 'John Doe <jdoe@example.com>')  | 
|
1250  | 
assertCommitter('John Smith', 'John Smith <jsmith@example.com>')  | 
|
1251  | 
assertCommitter('John Smith', 'John Smith')  | 
|
1252  | 
assertCommitter('jsmith@example.com', 'jsmith@example.com')  | 
|
1253  | 
assertCommitter('jsmith@example.com', '<jsmith@example.com>')  | 
|
1254  | 
assertCommitter('John Smith', 'John Smith jsmith@example.com')  | 
|
| 
2671.5.8
by Lukáš Lalinsky
 Add tests for LogFormatter.short_committer and LogFormatter.short_author.  | 
1255  | 
|
1256  | 
def test_short_author(self):  | 
|
| 
4955.4.15
by Vincent Ladeuil
 Remove duplicated code.  | 
1257  | 
def assertAuthor(expected, author):  | 
1258  | 
self.rev.properties['author'] = author  | 
|
1259  | 
self.assertEqual(expected, self.lf.short_author(self.rev))  | 
|
1260  | 
||
1261  | 
assertAuthor('John Smith', 'John Smith <jsmith@example.com>')  | 
|
1262  | 
assertAuthor('John Smith', 'John Smith')  | 
|
1263  | 
assertAuthor('jsmith@example.com', 'jsmith@example.com')  | 
|
1264  | 
assertAuthor('jsmith@example.com', '<jsmith@example.com>')  | 
|
1265  | 
assertAuthor('John Smith', 'John Smith jsmith@example.com')  | 
|
1266  | 
||
1267  | 
def test_short_author_from_committer(self):  | 
|
1268  | 
self.rev.committer = 'John Doe <jdoe@example.com>'  | 
|
1269  | 
self.assertEqual('John Doe', self.lf.short_author(self.rev))  | 
|
1270  | 
||
1271  | 
def test_short_author_from_authors(self):  | 
|
1272  | 
self.rev.properties['authors'] = ('John Smith <jsmith@example.com>\n'  | 
|
1273  | 
'Jane Rey <jrey@example.com>')  | 
|
1274  | 
self.assertEqual('John Smith', self.lf.short_author(self.rev))  | 
|
| 
3842.2.2
by Vincent Ladeuil
 Reproduce bug #300055.  | 
1275  | 
|
1276  | 
||
1277  | 
class TestReverseByDepth(tests.TestCase):  | 
|
1278  | 
"""Test reverse_by_depth behavior.  | 
|
1279  | 
||
1280  | 
    This is used to present revisions in forward (oldest first) order in a nice
 | 
|
1281  | 
    layout.
 | 
|
1282  | 
||
1283  | 
    The tests use lighter revision description to ease reading.
 | 
|
1284  | 
    """
 | 
|
1285  | 
||
1286  | 
def assertReversed(self, forward, backward):  | 
|
1287  | 
        # Transform the descriptions to suit the API: tests use (revno, depth),
 | 
|
1288  | 
        # while the API expects (revid, revno, depth)
 | 
|
1289  | 
def complete_revisions(l):  | 
|
1290  | 
"""Transform the description to suit the API.  | 
|
1291  | 
||
1292  | 
            Tests use (revno, depth) whil the API expects (revid, revno, depth).
 | 
|
1293  | 
            Since the revid is arbitrary, we just duplicate revno
 | 
|
1294  | 
            """
 | 
|
1295  | 
return [ (r, r, d) for r, d in l]  | 
|
1296  | 
forward = complete_revisions(forward)  | 
|
1297  | 
backward= complete_revisions(backward)  | 
|
1298  | 
self.assertEqual(forward, log.reverse_by_depth(backward))  | 
|
1299  | 
||
1300  | 
||
1301  | 
def test_mainline_revisions(self):  | 
|
1302  | 
self.assertReversed([( '1', 0), ('2', 0)],  | 
|
1303  | 
[('2', 0), ('1', 0)])  | 
|
1304  | 
||
1305  | 
def test_merged_revisions(self):  | 
|
| 
3842.2.3
by Vincent Ladeuil
 Yet more cleanup and fix test_file_id_f3 bogus test.  | 
1306  | 
self.assertReversed([('1', 0), ('2', 0), ('2.2', 1), ('2.1', 1),],  | 
1307  | 
[('2', 0), ('2.1', 1), ('2.2', 1), ('1', 0),])  | 
|
| 
3842.2.2
by Vincent Ladeuil
 Reproduce bug #300055.  | 
1308  | 
def test_shifted_merged_revisions(self):  | 
1309  | 
"""Test irregular layout.  | 
|
1310  | 
||
1311  | 
        Requesting revisions touching a file can produce "holes" in the depths.
 | 
|
1312  | 
        """
 | 
|
1313  | 
self.assertReversed([('1', 0), ('2', 0), ('1.1', 2), ('1.2', 2),],  | 
|
1314  | 
[('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.  | 
1315  | 
|
1316  | 
def test_merged_without_child_revisions(self):  | 
|
1317  | 
"""Test irregular layout.  | 
|
1318  | 
||
1319  | 
        Revision ranges can produce "holes" in the depths.
 | 
|
1320  | 
        """
 | 
|
1321  | 
        # When a revision of higher depth doesn't follow one of lower depth, we
 | 
|
1322  | 
        # assume a lower depth one is virtually there
 | 
|
1323  | 
self.assertReversed([('1', 2), ('2', 2), ('3', 3), ('4', 4)],  | 
|
1324  | 
[('4', 4), ('3', 3), ('2', 2), ('1', 2),])  | 
|
1325  | 
        # So we get the same order after reversing below even if the original
 | 
|
1326  | 
        # revisions are not in the same order.
 | 
|
1327  | 
self.assertReversed([('1', 2), ('2', 2), ('3', 3), ('4', 4)],  | 
|
1328  | 
[('3', 3), ('4', 4), ('2', 2), ('1', 2),])  | 
|
| 
3848.1.6
by Aaron Bentley
 Implement get_history_change  | 
1329  | 
|
1330  | 
||
| 
3848.1.8
by Aaron Bentley
 Implement basic show_branch_change  | 
1331  | 
class TestHistoryChange(tests.TestCaseWithTransport):  | 
| 
3848.1.6
by Aaron Bentley
 Implement get_history_change  | 
1332  | 
|
1333  | 
def setup_a_tree(self):  | 
|
1334  | 
tree = self.make_branch_and_tree('tree')  | 
|
1335  | 
tree.lock_write()  | 
|
1336  | 
self.addCleanup(tree.unlock)  | 
|
1337  | 
tree.commit('1a', rev_id='1a')  | 
|
1338  | 
tree.commit('2a', rev_id='2a')  | 
|
1339  | 
tree.commit('3a', rev_id='3a')  | 
|
1340  | 
return tree  | 
|
1341  | 
||
1342  | 
def setup_ab_tree(self):  | 
|
1343  | 
tree = self.setup_a_tree()  | 
|
1344  | 
tree.set_last_revision('1a')  | 
|
1345  | 
tree.branch.set_last_revision_info(1, '1a')  | 
|
1346  | 
tree.commit('2b', rev_id='2b')  | 
|
1347  | 
tree.commit('3b', rev_id='3b')  | 
|
1348  | 
return tree  | 
|
1349  | 
||
1350  | 
def setup_ac_tree(self):  | 
|
1351  | 
tree = self.setup_a_tree()  | 
|
1352  | 
tree.set_last_revision(revision.NULL_REVISION)  | 
|
1353  | 
tree.branch.set_last_revision_info(0, revision.NULL_REVISION)  | 
|
1354  | 
tree.commit('1c', rev_id='1c')  | 
|
1355  | 
tree.commit('2c', rev_id='2c')  | 
|
1356  | 
tree.commit('3c', rev_id='3c')  | 
|
1357  | 
return tree  | 
|
1358  | 
||
1359  | 
def test_all_new(self):  | 
|
1360  | 
tree = self.setup_ab_tree()  | 
|
| 
3848.1.7
by Aaron Bentley
 Use repository in get_history_change  | 
1361  | 
old, new = log.get_history_change('1a', '3a', tree.branch.repository)  | 
| 
3848.1.6
by Aaron Bentley
 Implement get_history_change  | 
1362  | 
self.assertEqual([], old)  | 
1363  | 
self.assertEqual(['2a', '3a'], new)  | 
|
1364  | 
||
1365  | 
def test_all_old(self):  | 
|
1366  | 
tree = self.setup_ab_tree()  | 
|
| 
3848.1.7
by Aaron Bentley
 Use repository in get_history_change  | 
1367  | 
old, new = log.get_history_change('3a', '1a', tree.branch.repository)  | 
| 
3848.1.6
by Aaron Bentley
 Implement get_history_change  | 
1368  | 
self.assertEqual([], new)  | 
1369  | 
self.assertEqual(['2a', '3a'], old)  | 
|
1370  | 
||
1371  | 
def test_null_old(self):  | 
|
1372  | 
tree = self.setup_ab_tree()  | 
|
1373  | 
old, new = log.get_history_change(revision.NULL_REVISION,  | 
|
| 
3848.1.7
by Aaron Bentley
 Use repository in get_history_change  | 
1374  | 
'3a', tree.branch.repository)  | 
| 
3848.1.6
by Aaron Bentley
 Implement get_history_change  | 
1375  | 
self.assertEqual([], old)  | 
1376  | 
self.assertEqual(['1a', '2a', '3a'], new)  | 
|
1377  | 
||
1378  | 
def test_null_new(self):  | 
|
1379  | 
tree = self.setup_ab_tree()  | 
|
| 
3848.1.7
by Aaron Bentley
 Use repository in get_history_change  | 
1380  | 
old, new = log.get_history_change('3a', revision.NULL_REVISION,  | 
1381  | 
tree.branch.repository)  | 
|
| 
3848.1.6
by Aaron Bentley
 Implement get_history_change  | 
1382  | 
self.assertEqual([], new)  | 
1383  | 
self.assertEqual(['1a', '2a', '3a'], old)  | 
|
1384  | 
||
1385  | 
def test_diverged(self):  | 
|
1386  | 
tree = self.setup_ab_tree()  | 
|
| 
3848.1.7
by Aaron Bentley
 Use repository in get_history_change  | 
1387  | 
old, new = log.get_history_change('3a', '3b', tree.branch.repository)  | 
| 
3848.1.6
by Aaron Bentley
 Implement get_history_change  | 
1388  | 
self.assertEqual(old, ['2a', '3a'])  | 
1389  | 
self.assertEqual(new, ['2b', '3b'])  | 
|
1390  | 
||
1391  | 
def test_unrelated(self):  | 
|
1392  | 
tree = self.setup_ac_tree()  | 
|
| 
3848.1.7
by Aaron Bentley
 Use repository in get_history_change  | 
1393  | 
old, new = log.get_history_change('3a', '3c', tree.branch.repository)  | 
| 
3848.1.6
by Aaron Bentley
 Implement get_history_change  | 
1394  | 
self.assertEqual(old, ['1a', '2a', '3a'])  | 
1395  | 
self.assertEqual(new, ['1c', '2c', '3c'])  | 
|
| 
3848.1.8
by Aaron Bentley
 Implement basic show_branch_change  | 
1396  | 
|
1397  | 
def test_show_branch_change(self):  | 
|
1398  | 
tree = self.setup_ab_tree()  | 
|
1399  | 
s = StringIO()  | 
|
| 
3848.1.12
by Aaron Bentley
 Fix test parameter order  | 
1400  | 
log.show_branch_change(tree.branch, s, 3, '3a')  | 
| 
3848.1.8
by Aaron Bentley
 Implement basic show_branch_change  | 
1401  | 
self.assertContainsRe(s.getvalue(),  | 
1402  | 
'[*]{60}\nRemoved Revisions:\n(.|\n)*2a(.|\n)*3a(.|\n)*'  | 
|
1403  | 
'[*]{60}\n\nAdded Revisions:\n(.|\n)*2b(.|\n)*3b')  | 
|
1404  | 
||
1405  | 
def test_show_branch_change_no_change(self):  | 
|
1406  | 
tree = self.setup_ab_tree()  | 
|
1407  | 
s = StringIO()  | 
|
| 
3848.1.12
by Aaron Bentley
 Fix test parameter order  | 
1408  | 
log.show_branch_change(tree.branch, s, 3, '3b')  | 
| 
3848.1.8
by Aaron Bentley
 Implement basic show_branch_change  | 
1409  | 
self.assertEqual(s.getvalue(),  | 
1410  | 
'Nothing seems to have changed\n')  | 
|
1411  | 
||
| 
3848.1.9
by Aaron Bentley
 new/old sections are omitted as appropriate.  | 
1412  | 
def test_show_branch_change_no_old(self):  | 
1413  | 
tree = self.setup_ab_tree()  | 
|
1414  | 
s = StringIO()  | 
|
| 
3848.1.12
by Aaron Bentley
 Fix test parameter order  | 
1415  | 
log.show_branch_change(tree.branch, s, 2, '2b')  | 
| 
3848.1.9
by Aaron Bentley
 new/old sections are omitted as appropriate.  | 
1416  | 
self.assertContainsRe(s.getvalue(), 'Added Revisions:')  | 
1417  | 
self.assertNotContainsRe(s.getvalue(), 'Removed Revisions:')  | 
|
1418  | 
||
1419  | 
def test_show_branch_change_no_new(self):  | 
|
1420  | 
tree = self.setup_ab_tree()  | 
|
1421  | 
tree.branch.set_last_revision_info(2, '2b')  | 
|
1422  | 
s = StringIO()  | 
|
| 
3848.1.12
by Aaron Bentley
 Fix test parameter order  | 
1423  | 
log.show_branch_change(tree.branch, s, 3, '3b')  | 
| 
3848.1.9
by Aaron Bentley
 new/old sections are omitted as appropriate.  | 
1424  | 
self.assertContainsRe(s.getvalue(), 'Removed Revisions:')  | 
1425  | 
self.assertNotContainsRe(s.getvalue(), 'Added Revisions:')  | 
|
| 
4921.2.1
by Neil Martinsen-Burrell
 include bug fixes in log output  | 
1426  | 
|
1427  | 
||
1428  | 
||
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
1429  | 
class TestLogWithBugs(TestCaseForLogFormatter, TestLogMixin):  | 
| 
4921.2.1
by Neil Martinsen-Burrell
 include bug fixes in log output  | 
1430  | 
|
1431  | 
def setUp(self):  | 
|
1432  | 
TestCaseForLogFormatter.setUp(self)  | 
|
1433  | 
log.properties_handler_registry.register(  | 
|
1434  | 
'bugs_properties_handler',  | 
|
1435  | 
log._bugs_properties_handler)  | 
|
1436  | 
||
| 
4921.2.2
by Neil Martinsen-Burrell
 from review comments: improve splitting, add test that handler is present, use build_tree in tests  | 
1437  | 
def make_commits_with_bugs(self):  | 
1438  | 
"""Helper method for LogFormatter tests"""  | 
|
1439  | 
tree = self.make_branch_and_tree(u'.')  | 
|
1440  | 
self.build_tree(['a', 'b'])  | 
|
1441  | 
tree.add('a')  | 
|
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
1442  | 
self.wt_commit(tree, 'simple log message', rev_id='a1',  | 
1443  | 
revprops={'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  | 
1444  | 
tree.add('b')  | 
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
1445  | 
self.wt_commit(tree, 'multiline\nlog\nmessage\n', rev_id='a2',  | 
1446  | 
authors=['Joe Bar <joe@bar.com>'],  | 
|
1447  | 
revprops={'bugs': 'test://bug/id fixed\n'  | 
|
1448  | 
'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  | 
1449  | 
return tree  | 
1450  | 
||
1451  | 
||
| 
4921.2.1
by Neil Martinsen-Burrell
 include bug fixes in log output  | 
1452  | 
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  | 
1453  | 
tree = self.make_commits_with_bugs()  | 
| 
4921.2.1
by Neil Martinsen-Burrell
 include bug fixes in log output  | 
1454  | 
self.assertFormatterResult("""\  | 
1455  | 
------------------------------------------------------------
 | 
|
1456  | 
revno: 2
 | 
|
1457  | 
fixes bug(s): test://bug/id test://bug/2
 | 
|
1458  | 
author: Joe Bar <joe@bar.com>
 | 
|
1459  | 
committer: Joe Foo <joe@foo.com>
 | 
|
1460  | 
branch nick: work
 | 
|
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
1461  | 
timestamp: Tue 2005-11-22 00:00:01 +0000
 | 
| 
4921.2.1
by Neil Martinsen-Burrell
 include bug fixes in log output  | 
1462  | 
message:
 | 
1463  | 
  multiline
 | 
|
1464  | 
  log
 | 
|
1465  | 
  message
 | 
|
1466  | 
------------------------------------------------------------
 | 
|
1467  | 
revno: 1
 | 
|
1468  | 
fixes bug(s): test://bug/id
 | 
|
1469  | 
committer: Joe Foo <joe@foo.com>
 | 
|
1470  | 
branch nick: work
 | 
|
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
1471  | 
timestamp: Tue 2005-11-22 00:00:00 +0000
 | 
| 
4921.2.1
by Neil Martinsen-Burrell
 include bug fixes in log output  | 
1472  | 
message:
 | 
1473  | 
  simple log message
 | 
|
1474  | 
""",  | 
|
1475  | 
tree.branch, log.LongLogFormatter)  | 
|
1476  | 
||
1477  | 
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  | 
1478  | 
tree = self.make_commits_with_bugs()  | 
| 
4921.2.1
by Neil Martinsen-Burrell
 include bug fixes in log output  | 
1479  | 
self.assertFormatterResult("""\  | 
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
1480  | 
2 Joe Bar\t2005-11-22  | 
| 
4921.2.1
by Neil Martinsen-Burrell
 include bug fixes in log output  | 
1481  | 
      fixes bug(s): test://bug/id test://bug/2
 | 
1482  | 
      multiline
 | 
|
1483  | 
      log
 | 
|
1484  | 
      message
 | 
|
1485  | 
||
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
1486  | 
1 Joe Foo\t2005-11-22  | 
| 
4921.2.1
by Neil Martinsen-Burrell
 include bug fixes in log output  | 
1487  | 
      fixes bug(s): test://bug/id
 | 
1488  | 
      simple log message
 | 
|
1489  | 
||
1490  | 
""",  | 
|
1491  | 
tree.branch, log.ShortLogFormatter)  | 
|
1492  | 
||
1493  | 
def test_wrong_bugs_property(self):  | 
|
1494  | 
tree = self.make_branch_and_tree(u'.')  | 
|
1495  | 
self.build_tree(['foo'])  | 
|
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
1496  | 
self.wt_commit(tree, 'simple log message', rev_id='a1',  | 
1497  | 
revprops={'bugs': 'test://bug/id invalid_value'})  | 
|
| 
4921.2.1
by Neil Martinsen-Burrell
 include bug fixes in log output  | 
1498  | 
self.assertFormatterResult("""\  | 
| 
4955.4.17
by Vincent Ladeuil
 Use a data factory for commit properties and reduce code duplication.  | 
1499  | 
1 Joe Foo\t2005-11-22  | 
| 
4921.2.1
by Neil Martinsen-Burrell
 include bug fixes in log output  | 
1500  | 
      simple log message
 | 
1501  | 
||
1502  | 
""",  | 
|
1503  | 
tree.branch, log.ShortLogFormatter)  | 
|
| 
4921.2.2
by Neil Martinsen-Burrell
 from review comments: improve splitting, add test that handler is present, use build_tree in tests  | 
1504  | 
|
1505  | 
def test_bugs_handler_present(self):  | 
|
1506  | 
self.properties_handler_registry.get('bugs_properties_handler')  |