bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
| 
2220.2.3
by Martin Pool
 Add tag: revision namespace.  | 
1  | 
# Copyright (C) 2004, 2005, 2006, 2007 Canonical Ltd
 | 
| 
1887.1.1
by Adeodato Simó
 Do not separate paragraphs in the copyright statement with blank lines,  | 
2  | 
#
 | 
| 
897
by Martin Pool
 - merge john's revision-naming code  | 
3  | 
# This program is free software; you can redistribute it and/or modify
 | 
4  | 
# it under the terms of the GNU General Public License as published by
 | 
|
5  | 
# the Free Software Foundation; either version 2 of the License, or
 | 
|
6  | 
# (at your option) any later version.
 | 
|
| 
1887.1.1
by Adeodato Simó
 Do not separate paragraphs in the copyright statement with blank lines,  | 
7  | 
#
 | 
| 
897
by Martin Pool
 - merge john's revision-naming code  | 
8  | 
# This program is distributed in the hope that it will be useful,
 | 
9  | 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
|
10  | 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
|
11  | 
# GNU General Public License for more details.
 | 
|
| 
1887.1.1
by Adeodato Simó
 Do not separate paragraphs in the copyright statement with blank lines,  | 
12  | 
#
 | 
| 
897
by Martin Pool
 - merge john's revision-naming code  | 
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
 | 
|
15  | 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 | 
|
16  | 
||
| 
1948.4.12
by John Arbash Meinel
 Some tests for the date: spec  | 
17  | 
import datetime  | 
| 
974.1.52
by aaron.bentley at utoronto
 Merged mpool's latest changes (~0.0.7)  | 
18  | 
import os  | 
| 
1185.1.39
by Robert Collins
 Robey Pointers before: namespace to clear up usage of dates in revision parameters  | 
19  | 
import time  | 
| 
1432
by Robert Collins
 branch: namespace  | 
20  | 
|
| 
1948.4.1
by John Arbash Meinel
 Update number parsers to raise InvalidRevisionSpec. Update revno: itself so it supports negative numbers  | 
21  | 
from bzrlib import (  | 
| 
2220.2.11
by mbp at sourcefrog
 Get tag tests working again, stored in the Branch  | 
22  | 
branch,  | 
| 
2220.2.3
by Martin Pool
 Add tag: revision namespace.  | 
23  | 
bzrdir,  | 
| 
1948.4.1
by John Arbash Meinel
 Update number parsers to raise InvalidRevisionSpec. Update revno: itself so it supports negative numbers  | 
24  | 
errors,  | 
| 
2220.2.3
by Martin Pool
 Add tag: revision namespace.  | 
25  | 
repository,  | 
| 
1948.4.1
by John Arbash Meinel
 Update number parsers to raise InvalidRevisionSpec. Update revno: itself so it supports negative numbers  | 
26  | 
    )
 | 
| 
1988.4.5
by Robert Collins
 revisions can now be specified using dotted-decimal revision numbers.  | 
27  | 
from bzrlib.tests import TestCase, TestCaseWithTransport  | 
| 
2220.2.3
by Martin Pool
 Add tag: revision namespace.  | 
28  | 
from bzrlib.revisionspec import (  | 
29  | 
RevisionSpec,  | 
|
30  | 
RevisionSpec_revno,  | 
|
31  | 
RevisionSpec_tag,  | 
|
32  | 
    )
 | 
|
| 
1948.4.33
by John Arbash Meinel
 Switch from get_revision_spec() to RevisionSpec.from_string() (as advised by Martin)  | 
33  | 
|
34  | 
||
35  | 
def spec_in_history(spec, branch):  | 
|
36  | 
"""A simple helper to change a revision spec into a branch search"""  | 
|
37  | 
return RevisionSpec.from_string(spec).in_history(branch)  | 
|
| 
1534.4.26
by Robert Collins
 Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create.  | 
38  | 
|
39  | 
||
| 
1948.4.3
by John Arbash Meinel
 Create direct tests for RevisionSpec_int  | 
40  | 
# Basic class, which just creates a really basic set of revisions
 | 
41  | 
class TestRevisionSpec(TestCaseWithTransport):  | 
|
42  | 
||
43  | 
def setUp(self):  | 
|
44  | 
super(TestRevisionSpec, self).setUp()  | 
|
| 
1988.4.5
by Robert Collins
 revisions can now be specified using dotted-decimal revision numbers.  | 
45  | 
        # this sets up a revision graph:
 | 
46  | 
        # r1: []             1
 | 
|
47  | 
        # alt_r2: [r1]       1.1.1
 | 
|
48  | 
        # r2: [r1, alt_r2]   2
 | 
|
| 
1948.4.3
by John Arbash Meinel
 Create direct tests for RevisionSpec_int  | 
49  | 
|
50  | 
self.tree = self.make_branch_and_tree('tree')  | 
|
51  | 
self.build_tree(['tree/a'])  | 
|
| 
3298.2.3
by John Arbash Meinel
 Add tests that all RevisionSpecs implement in_branch(b, needs_revno)  | 
52  | 
self.tree.lock_write()  | 
| 
3298.2.11
by Aaron Bentley
 Update tests for null:, clea up slightly  | 
53  | 
self.addCleanup(self.tree.unlock)  | 
54  | 
self.tree.add(['a'])  | 
|
55  | 
self.tree.commit('a', rev_id='r1')  | 
|
56  | 
||
57  | 
self.tree2 = self.tree.bzrdir.sprout('tree2').open_workingtree()  | 
|
58  | 
self.tree2.commit('alt', rev_id='alt_r2')  | 
|
59  | 
||
60  | 
self.tree.merge_from_branch(self.tree2.branch)  | 
|
61  | 
self.tree.commit('second', rev_id='r2')  | 
|
| 
1948.4.3
by John Arbash Meinel
 Create direct tests for RevisionSpec_int  | 
62  | 
|
63  | 
def get_in_history(self, revision_spec):  | 
|
| 
1948.4.33
by John Arbash Meinel
 Switch from get_revision_spec() to RevisionSpec.from_string() (as advised by Martin)  | 
64  | 
return spec_in_history(revision_spec, self.tree.branch)  | 
| 
1948.4.3
by John Arbash Meinel
 Create direct tests for RevisionSpec_int  | 
65  | 
|
66  | 
def assertInHistoryIs(self, exp_revno, exp_revision_id, revision_spec):  | 
|
67  | 
rev_info = self.get_in_history(revision_spec)  | 
|
68  | 
self.assertEqual(exp_revno, rev_info.revno,  | 
|
| 
2325.2.1
by Marien Zwart
 Make the test suite failure reporting a bit more robust.  | 
69  | 
'Revision spec: %r returned wrong revno: %r != %r'  | 
| 
1948.4.3
by John Arbash Meinel
 Create direct tests for RevisionSpec_int  | 
70  | 
% (revision_spec, exp_revno, rev_info.revno))  | 
71  | 
self.assertEqual(exp_revision_id, rev_info.rev_id,  | 
|
| 
2325.2.1
by Marien Zwart
 Make the test suite failure reporting a bit more robust.  | 
72  | 
'Revision spec: %r returned wrong revision id:'  | 
73  | 
' %r != %r'  | 
|
| 
1948.4.3
by John Arbash Meinel
 Create direct tests for RevisionSpec_int  | 
74  | 
% (revision_spec, exp_revision_id, rev_info.rev_id))  | 
75  | 
||
| 
1948.4.23
by John Arbash Meinel
 Change the handling of negative numbers, to be trapped at revno 1  | 
76  | 
def assertInvalid(self, revision_spec, extra=''):  | 
| 
1948.4.3
by John Arbash Meinel
 Create direct tests for RevisionSpec_int  | 
77  | 
try:  | 
78  | 
self.get_in_history(revision_spec)  | 
|
79  | 
except errors.InvalidRevisionSpec, e:  | 
|
| 
1948.4.23
by John Arbash Meinel
 Change the handling of negative numbers, to be trapped at revno 1  | 
80  | 
self.assertEqual(revision_spec, e.spec)  | 
| 
1948.4.3
by John Arbash Meinel
 Create direct tests for RevisionSpec_int  | 
81  | 
self.assertEqual(extra, e.extra)  | 
| 
1948.4.5
by John Arbash Meinel
 Fix tests for negative entries, and add tests for revno:  | 
82  | 
else:  | 
83  | 
self.fail('Expected InvalidRevisionSpec to be raised for %s'  | 
|
84  | 
% (revision_spec,))  | 
|
| 
1948.4.3
by John Arbash Meinel
 Create direct tests for RevisionSpec_int  | 
85  | 
|
| 
3298.2.4
by John Arbash Meinel
 Introduce as_revision_id() as a function instead of in_branch(need_revno=False)  | 
86  | 
def assertAsRevisionId(self, revision_id, revision_spec):  | 
87  | 
"""Calling as_revision_id() should return the specified id."""  | 
|
88  | 
spec = RevisionSpec.from_string(revision_spec)  | 
|
89  | 
self.assertEqual(revision_id,  | 
|
90  | 
spec.as_revision_id(self.tree.branch))  | 
|
91  | 
||
| 
1948.4.3
by John Arbash Meinel
 Create direct tests for RevisionSpec_int  | 
92  | 
|
| 
1948.4.19
by John Arbash Meinel
 All old tests are covered elsewhere  | 
93  | 
class TestOddRevisionSpec(TestRevisionSpec):  | 
94  | 
"""Test things that aren't normally thought of as revision specs"""  | 
|
95  | 
||
96  | 
def test_none(self):  | 
|
| 
3298.2.11
by Aaron Bentley
 Update tests for null:, clea up slightly  | 
97  | 
self.assertInHistoryIs(None, None, None)  | 
| 
1948.4.19
by John Arbash Meinel
 All old tests are covered elsewhere  | 
98  | 
|
99  | 
def test_object(self):  | 
|
| 
1948.4.33
by John Arbash Meinel
 Switch from get_revision_spec() to RevisionSpec.from_string() (as advised by Martin)  | 
100  | 
self.assertRaises(TypeError, RevisionSpec.from_string, object())  | 
| 
1948.4.19
by John Arbash Meinel
 All old tests are covered elsewhere  | 
101  | 
|
| 
1948.4.25
by John Arbash Meinel
 Check that invalid specs are properly handled  | 
102  | 
def test_unregistered_spec(self):  | 
| 
1948.4.33
by John Arbash Meinel
 Switch from get_revision_spec() to RevisionSpec.from_string() (as advised by Martin)  | 
103  | 
self.assertRaises(errors.NoSuchRevisionSpec,  | 
104  | 
RevisionSpec.from_string, 'foo')  | 
|
105  | 
self.assertRaises(errors.NoSuchRevisionSpec,  | 
|
106  | 
RevisionSpec.from_string, '123a')  | 
|
| 
1948.4.32
by John Arbash Meinel
 Clean up __repr__, as well as add tests that we can handle -r12:branch/  | 
107  | 
|
108  | 
||
| 
1988.4.5
by Robert Collins
 revisions can now be specified using dotted-decimal revision numbers.  | 
109  | 
|
110  | 
class TestRevnoFromString(TestCase):  | 
|
111  | 
||
112  | 
def test_from_string_dotted_decimal(self):  | 
|
113  | 
self.assertRaises(errors.NoSuchRevisionSpec, RevisionSpec.from_string, '-1.1')  | 
|
114  | 
self.assertRaises(errors.NoSuchRevisionSpec, RevisionSpec.from_string, '.1')  | 
|
115  | 
self.assertRaises(errors.NoSuchRevisionSpec, RevisionSpec.from_string, '1..1')  | 
|
116  | 
self.assertRaises(errors.NoSuchRevisionSpec, RevisionSpec.from_string, '1.2..1')  | 
|
117  | 
self.assertRaises(errors.NoSuchRevisionSpec, RevisionSpec.from_string, '1.')  | 
|
118  | 
self.assertIsInstance(RevisionSpec.from_string('1.1'), RevisionSpec_revno)  | 
|
119  | 
self.assertIsInstance(RevisionSpec.from_string('1.1.3'), RevisionSpec_revno)  | 
|
120  | 
||
121  | 
||
| 
1948.4.32
by John Arbash Meinel
 Clean up __repr__, as well as add tests that we can handle -r12:branch/  | 
122  | 
class TestRevisionSpec_revno(TestRevisionSpec):  | 
123  | 
||
124  | 
def test_positive_int(self):  | 
|
| 
2598.5.10
by Aaron Bentley
 Return NULL_REVISION instead of None for the null revision  | 
125  | 
self.assertInHistoryIs(0, 'null:', '0')  | 
| 
1948.4.3
by John Arbash Meinel
 Create direct tests for RevisionSpec_int  | 
126  | 
self.assertInHistoryIs(1, 'r1', '1')  | 
127  | 
self.assertInHistoryIs(2, 'r2', '2')  | 
|
| 
1948.4.23
by John Arbash Meinel
 Change the handling of negative numbers, to be trapped at revno 1  | 
128  | 
self.assertInvalid('3')  | 
| 
1948.4.3
by John Arbash Meinel
 Create direct tests for RevisionSpec_int  | 
129  | 
|
| 
1988.4.5
by Robert Collins
 revisions can now be specified using dotted-decimal revision numbers.  | 
130  | 
def test_dotted_decimal(self):  | 
131  | 
self.assertInHistoryIs(None, 'alt_r2', '1.1.1')  | 
|
132  | 
||
| 
1948.4.32
by John Arbash Meinel
 Clean up __repr__, as well as add tests that we can handle -r12:branch/  | 
133  | 
def test_negative_int(self):  | 
| 
1948.4.3
by John Arbash Meinel
 Create direct tests for RevisionSpec_int  | 
134  | 
self.assertInHistoryIs(2, 'r2', '-1')  | 
135  | 
self.assertInHistoryIs(1, 'r1', '-2')  | 
|
136  | 
||
| 
1948.4.23
by John Arbash Meinel
 Change the handling of negative numbers, to be trapped at revno 1  | 
137  | 
self.assertInHistoryIs(1, 'r1', '-3')  | 
138  | 
self.assertInHistoryIs(1, 'r1', '-4')  | 
|
139  | 
self.assertInHistoryIs(1, 'r1', '-100')  | 
|
| 
1948.4.5
by John Arbash Meinel
 Fix tests for negative entries, and add tests for revno:  | 
140  | 
|
141  | 
def test_positive(self):  | 
|
| 
2598.5.10
by Aaron Bentley
 Return NULL_REVISION instead of None for the null revision  | 
142  | 
self.assertInHistoryIs(0, 'null:', 'revno:0')  | 
| 
1948.4.5
by John Arbash Meinel
 Fix tests for negative entries, and add tests for revno:  | 
143  | 
self.assertInHistoryIs(1, 'r1', 'revno:1')  | 
144  | 
self.assertInHistoryIs(2, 'r2', 'revno:2')  | 
|
145  | 
||
146  | 
self.assertInvalid('revno:3')  | 
|
147  | 
||
148  | 
def test_negative(self):  | 
|
149  | 
self.assertInHistoryIs(2, 'r2', 'revno:-1')  | 
|
150  | 
self.assertInHistoryIs(1, 'r1', 'revno:-2')  | 
|
151  | 
||
| 
1948.4.23
by John Arbash Meinel
 Change the handling of negative numbers, to be trapped at revno 1  | 
152  | 
self.assertInHistoryIs(1, 'r1', 'revno:-3')  | 
153  | 
self.assertInHistoryIs(1, 'r1', 'revno:-4')  | 
|
| 
1948.4.6
by John Arbash Meinel
 A small bugfix, and more tests for revno:  | 
154  | 
|
155  | 
def test_invalid_number(self):  | 
|
156  | 
        # Get the right exception text
 | 
|
157  | 
try:  | 
|
158  | 
int('X')  | 
|
159  | 
except ValueError, e:  | 
|
160  | 
            pass
 | 
|
| 
1948.4.15
by John Arbash Meinel
 Change the InvalidRevisionSpec formatting to be more readable  | 
161  | 
self.assertInvalid('revno:X', extra='\n' + str(e))  | 
| 
1948.4.6
by John Arbash Meinel
 A small bugfix, and more tests for revno:  | 
162  | 
|
163  | 
def test_missing_number_and_branch(self):  | 
|
164  | 
self.assertInvalid('revno::',  | 
|
| 
1948.4.15
by John Arbash Meinel
 Change the InvalidRevisionSpec formatting to be more readable  | 
165  | 
extra='\ncannot have an empty revno and no branch')  | 
| 
1948.4.7
by John Arbash Meinel
 More revno: tests, now testing the branch/url parameter  | 
166  | 
|
167  | 
def test_invalid_number_with_branch(self):  | 
|
168  | 
try:  | 
|
169  | 
int('X')  | 
|
170  | 
except ValueError, e:  | 
|
171  | 
            pass
 | 
|
| 
1948.4.15
by John Arbash Meinel
 Change the InvalidRevisionSpec formatting to be more readable  | 
172  | 
self.assertInvalid('revno:X:tree2', extra='\n' + str(e))  | 
| 
1948.4.7
by John Arbash Meinel
 More revno: tests, now testing the branch/url parameter  | 
173  | 
|
| 
1948.4.16
by John Arbash Meinel
 Move the tests into the associated tester, remove redundant tests, some small PEP8 changes  | 
174  | 
def test_non_exact_branch(self):  | 
175  | 
        # It seems better to require an exact path to the branch
 | 
|
176  | 
        # Branch.open() rather than using Branch.open_containing()
 | 
|
| 
1948.4.33
by John Arbash Meinel
 Switch from get_revision_spec() to RevisionSpec.from_string() (as advised by Martin)  | 
177  | 
spec = RevisionSpec.from_string('revno:2:tree2/a')  | 
| 
1948.4.16
by John Arbash Meinel
 Move the tests into the associated tester, remove redundant tests, some small PEP8 changes  | 
178  | 
self.assertRaises(errors.NotBranchError,  | 
| 
1948.4.33
by John Arbash Meinel
 Switch from get_revision_spec() to RevisionSpec.from_string() (as advised by Martin)  | 
179  | 
spec.in_history, self.tree.branch)  | 
| 
1948.4.16
by John Arbash Meinel
 Move the tests into the associated tester, remove redundant tests, some small PEP8 changes  | 
180  | 
|
| 
1948.4.7
by John Arbash Meinel
 More revno: tests, now testing the branch/url parameter  | 
181  | 
def test_with_branch(self):  | 
182  | 
        # Passing a URL overrides the supplied branch path
 | 
|
183  | 
revinfo = self.get_in_history('revno:2:tree2')  | 
|
184  | 
self.assertNotEqual(self.tree.branch.base, revinfo.branch.base)  | 
|
185  | 
self.assertEqual(self.tree2.branch.base, revinfo.branch.base)  | 
|
186  | 
self.assertEqual(2, revinfo.revno)  | 
|
187  | 
self.assertEqual('alt_r2', revinfo.rev_id)  | 
|
188  | 
||
| 
1948.4.32
by John Arbash Meinel
 Clean up __repr__, as well as add tests that we can handle -r12:branch/  | 
189  | 
def test_int_with_branch(self):  | 
190  | 
revinfo = self.get_in_history('2:tree2')  | 
|
191  | 
self.assertNotEqual(self.tree.branch.base, revinfo.branch.base)  | 
|
192  | 
self.assertEqual(self.tree2.branch.base, revinfo.branch.base)  | 
|
193  | 
self.assertEqual(2, revinfo.revno)  | 
|
194  | 
self.assertEqual('alt_r2', revinfo.rev_id)  | 
|
195  | 
||
| 
1948.4.7
by John Arbash Meinel
 More revno: tests, now testing the branch/url parameter  | 
196  | 
def test_with_url(self):  | 
197  | 
url = self.get_url() + '/tree2'  | 
|
198  | 
revinfo = self.get_in_history('revno:2:%s' % (url,))  | 
|
199  | 
self.assertNotEqual(self.tree.branch.base, revinfo.branch.base)  | 
|
200  | 
self.assertEqual(self.tree2.branch.base, revinfo.branch.base)  | 
|
201  | 
self.assertEqual(2, revinfo.revno)  | 
|
202  | 
self.assertEqual('alt_r2', revinfo.rev_id)  | 
|
203  | 
||
204  | 
def test_negative_with_url(self):  | 
|
205  | 
url = self.get_url() + '/tree2'  | 
|
206  | 
revinfo = self.get_in_history('revno:-1:%s' % (url,))  | 
|
207  | 
self.assertNotEqual(self.tree.branch.base, revinfo.branch.base)  | 
|
208  | 
self.assertEqual(self.tree2.branch.base, revinfo.branch.base)  | 
|
209  | 
self.assertEqual(2, revinfo.revno)  | 
|
210  | 
self.assertEqual('alt_r2', revinfo.rev_id)  | 
|
211  | 
||
| 
1948.4.22
by John Arbash Meinel
 Refactor common code from integer revno handlers  | 
212  | 
def test_different_history_lengths(self):  | 
213  | 
        # Make sure we use the revisions and offsets in the supplied branch
 | 
|
214  | 
        # not the ones in the original branch.
 | 
|
215  | 
self.tree2.commit('three', rev_id='r3')  | 
|
216  | 
self.assertInHistoryIs(3, 'r3', 'revno:3:tree2')  | 
|
217  | 
self.assertInHistoryIs(3, 'r3', 'revno:-1:tree2')  | 
|
218  | 
||
| 
1948.4.7
by John Arbash Meinel
 More revno: tests, now testing the branch/url parameter  | 
219  | 
def test_invalid_branch(self):  | 
220  | 
self.assertRaises(errors.NotBranchError,  | 
|
221  | 
self.get_in_history, 'revno:-1:tree3')  | 
|
222  | 
||
223  | 
def test_invalid_revno_in_branch(self):  | 
|
224  | 
self.tree.commit('three', rev_id='r3')  | 
|
225  | 
self.assertInvalid('revno:3:tree2')  | 
|
| 
1948.4.8
by John Arbash Meinel
 Testing the revid: spec  | 
226  | 
|
| 
1948.4.16
by John Arbash Meinel
 Move the tests into the associated tester, remove redundant tests, some small PEP8 changes  | 
227  | 
def test_revno_n_path(self):  | 
228  | 
"""Old revno:N:path tests"""  | 
|
229  | 
wta = self.make_branch_and_tree('a')  | 
|
230  | 
ba = wta.branch  | 
|
231  | 
||
232  | 
wta.commit('Commit one', rev_id='a@r-0-1')  | 
|
233  | 
wta.commit('Commit two', rev_id='a@r-0-2')  | 
|
234  | 
wta.commit('Commit three', rev_id='a@r-0-3')  | 
|
235  | 
||
236  | 
wtb = self.make_branch_and_tree('b')  | 
|
237  | 
bb = wtb.branch  | 
|
238  | 
||
239  | 
wtb.commit('Commit one', rev_id='b@r-0-1')  | 
|
240  | 
wtb.commit('Commit two', rev_id='b@r-0-2')  | 
|
241  | 
wtb.commit('Commit three', rev_id='b@r-0-3')  | 
|
242  | 
||
| 
1948.4.33
by John Arbash Meinel
 Switch from get_revision_spec() to RevisionSpec.from_string() (as advised by Martin)  | 
243  | 
|
244  | 
self.assertEqual((1, 'a@r-0-1'),  | 
|
245  | 
spec_in_history('revno:1:a/', ba))  | 
|
| 
1948.4.16
by John Arbash Meinel
 Move the tests into the associated tester, remove redundant tests, some small PEP8 changes  | 
246  | 
        # The argument of in_history should be ignored since it is
 | 
247  | 
        # redundant with the path in the spec.
 | 
|
| 
1948.4.33
by John Arbash Meinel
 Switch from get_revision_spec() to RevisionSpec.from_string() (as advised by Martin)  | 
248  | 
self.assertEqual((1, 'a@r-0-1'),  | 
249  | 
spec_in_history('revno:1:a/', None))  | 
|
250  | 
self.assertEqual((1, 'a@r-0-1'),  | 
|
251  | 
spec_in_history('revno:1:a/', bb))  | 
|
252  | 
self.assertEqual((2, 'b@r-0-2'),  | 
|
253  | 
spec_in_history('revno:2:b/', None))  | 
|
| 
1948.4.16
by John Arbash Meinel
 Move the tests into the associated tester, remove redundant tests, some small PEP8 changes  | 
254  | 
|
| 
3298.2.4
by John Arbash Meinel
 Introduce as_revision_id() as a function instead of in_branch(need_revno=False)  | 
255  | 
def test_as_revision_id(self):  | 
| 
3298.2.11
by Aaron Bentley
 Update tests for null:, clea up slightly  | 
256  | 
self.assertAsRevisionId('null:', '0')  | 
| 
3298.2.4
by John Arbash Meinel
 Introduce as_revision_id() as a function instead of in_branch(need_revno=False)  | 
257  | 
self.assertAsRevisionId('r1', '1')  | 
258  | 
self.assertAsRevisionId('r2', '2')  | 
|
259  | 
self.assertAsRevisionId('r1', '-2')  | 
|
260  | 
self.assertAsRevisionId('r2', '-1')  | 
|
261  | 
self.assertAsRevisionId('alt_r2', '1.1.1')  | 
|
262  | 
||
| 
1948.4.8
by John Arbash Meinel
 Testing the revid: spec  | 
263  | 
|
264  | 
class TestRevisionSpec_revid(TestRevisionSpec):  | 
|
265  | 
||
266  | 
def test_in_history(self):  | 
|
267  | 
        # We should be able to access revisions that are directly
 | 
|
268  | 
        # in the history.
 | 
|
269  | 
self.assertInHistoryIs(1, 'r1', 'revid:r1')  | 
|
270  | 
self.assertInHistoryIs(2, 'r2', 'revid:r2')  | 
|
271  | 
||
272  | 
def test_missing(self):  | 
|
273  | 
self.assertInvalid('revid:r3')  | 
|
274  | 
||
275  | 
def test_merged(self):  | 
|
276  | 
"""We can reach revisions in the ancestry"""  | 
|
277  | 
self.assertInHistoryIs(None, 'alt_r2', 'revid:alt_r2')  | 
|
278  | 
||
279  | 
def test_not_here(self):  | 
|
280  | 
self.tree2.commit('alt third', rev_id='alt_r3')  | 
|
281  | 
        # It exists in tree2, but not in tree
 | 
|
282  | 
self.assertInvalid('revid:alt_r3')  | 
|
283  | 
||
284  | 
def test_in_repository(self):  | 
|
285  | 
"""We can get any revision id in the repository"""  | 
|
286  | 
        # XXX: This may change in the future, but for now, it is true
 | 
|
287  | 
self.tree2.commit('alt third', rev_id='alt_r3')  | 
|
288  | 
self.tree.branch.repository.fetch(self.tree2.branch.repository,  | 
|
289  | 
revision_id='alt_r3')  | 
|
290  | 
self.assertInHistoryIs(None, 'alt_r3', 'revid:alt_r3')  | 
|
| 
1948.4.9
by John Arbash Meinel
 Cleanup and test last:  | 
291  | 
|
| 
2325.2.2
by Marien Zwart
 Make the revid RevisionSpec always return a str object, not a unicode object.  | 
292  | 
def test_unicode(self):  | 
293  | 
"""We correctly convert a unicode ui string to an encoded revid."""  | 
|
| 
2325.2.4
by Marien Zwart
 Rename rev_id to revision_id because HACKING says so.  | 
294  | 
revision_id = u'\N{SNOWMAN}'.encode('utf-8')  | 
295  | 
self.tree.commit('unicode', rev_id=revision_id)  | 
|
296  | 
self.assertInHistoryIs(3, revision_id, u'revid:\N{SNOWMAN}')  | 
|
297  | 
self.assertInHistoryIs(3, revision_id, 'revid:' + revision_id)  | 
|
| 
2325.2.2
by Marien Zwart
 Make the revid RevisionSpec always return a str object, not a unicode object.  | 
298  | 
|
| 
3298.2.4
by John Arbash Meinel
 Introduce as_revision_id() as a function instead of in_branch(need_revno=False)  | 
299  | 
def test_as_revision_id(self):  | 
300  | 
self.assertAsRevisionId('r1', 'revid:r1')  | 
|
301  | 
self.assertAsRevisionId('r2', 'revid:r2')  | 
|
302  | 
self.assertAsRevisionId('alt_r2', 'revid:alt_r2')  | 
|
303  | 
||
| 
1948.4.9
by John Arbash Meinel
 Cleanup and test last:  | 
304  | 
|
305  | 
class TestRevisionSpec_last(TestRevisionSpec):  | 
|
306  | 
||
307  | 
def test_positive(self):  | 
|
308  | 
self.assertInHistoryIs(2, 'r2', 'last:1')  | 
|
309  | 
self.assertInHistoryIs(1, 'r1', 'last:2')  | 
|
| 
2598.5.10
by Aaron Bentley
 Return NULL_REVISION instead of None for the null revision  | 
310  | 
self.assertInHistoryIs(0, 'null:', 'last:3')  | 
| 
1948.4.9
by John Arbash Meinel
 Cleanup and test last:  | 
311  | 
|
312  | 
def test_empty(self):  | 
|
313  | 
self.assertInHistoryIs(2, 'r2', 'last:')  | 
|
314  | 
||
315  | 
def test_negative(self):  | 
|
316  | 
self.assertInvalid('last:-1',  | 
|
| 
1948.4.15
by John Arbash Meinel
 Change the InvalidRevisionSpec formatting to be more readable  | 
317  | 
extra='\nyou must supply a positive value')  | 
| 
1948.4.9
by John Arbash Meinel
 Cleanup and test last:  | 
318  | 
|
319  | 
def test_missing(self):  | 
|
320  | 
self.assertInvalid('last:4')  | 
|
321  | 
||
322  | 
def test_no_history(self):  | 
|
323  | 
tree = self.make_branch_and_tree('tree3')  | 
|
324  | 
||
325  | 
self.assertRaises(errors.NoCommits,  | 
|
| 
1948.4.33
by John Arbash Meinel
 Switch from get_revision_spec() to RevisionSpec.from_string() (as advised by Martin)  | 
326  | 
spec_in_history, 'last:', tree.branch)  | 
| 
1948.4.9
by John Arbash Meinel
 Cleanup and test last:  | 
327  | 
|
328  | 
def test_not_a_number(self):  | 
|
329  | 
try:  | 
|
330  | 
int('Y')  | 
|
331  | 
except ValueError, e:  | 
|
332  | 
            pass
 | 
|
| 
1948.4.15
by John Arbash Meinel
 Change the InvalidRevisionSpec formatting to be more readable  | 
333  | 
self.assertInvalid('last:Y', extra='\n' + str(e))  | 
| 
1948.4.10
by John Arbash Meinel
 test the before: spec, currently asserting what seems to be buggy behavior  | 
334  | 
|
| 
3298.2.4
by John Arbash Meinel
 Introduce as_revision_id() as a function instead of in_branch(need_revno=False)  | 
335  | 
def test_as_revision_id(self):  | 
336  | 
self.assertAsRevisionId('r2', 'last:1')  | 
|
337  | 
self.assertAsRevisionId('r1', 'last:2')  | 
|
338  | 
||
| 
1948.4.10
by John Arbash Meinel
 test the before: spec, currently asserting what seems to be buggy behavior  | 
339  | 
|
340  | 
class TestRevisionSpec_before(TestRevisionSpec):  | 
|
341  | 
||
342  | 
def test_int(self):  | 
|
343  | 
self.assertInHistoryIs(1, 'r1', 'before:2')  | 
|
344  | 
self.assertInHistoryIs(1, 'r1', 'before:-1')  | 
|
345  | 
||
346  | 
def test_before_one(self):  | 
|
| 
2598.5.10
by Aaron Bentley
 Return NULL_REVISION instead of None for the null revision  | 
347  | 
self.assertInHistoryIs(0, 'null:', 'before:1')  | 
| 
1948.4.10
by John Arbash Meinel
 test the before: spec, currently asserting what seems to be buggy behavior  | 
348  | 
|
349  | 
def test_before_none(self):  | 
|
| 
1948.4.13
by John Arbash Meinel
 Going before:0 is an error, and if you are on another history, use the leftmost parent  | 
350  | 
self.assertInvalid('before:0',  | 
| 
1948.4.15
by John Arbash Meinel
 Change the InvalidRevisionSpec formatting to be more readable  | 
351  | 
extra='\ncannot go before the null: revision')  | 
| 
1948.4.10
by John Arbash Meinel
 test the before: spec, currently asserting what seems to be buggy behavior  | 
352  | 
|
353  | 
def test_revid(self):  | 
|
354  | 
self.assertInHistoryIs(1, 'r1', 'before:revid:r2')  | 
|
355  | 
||
356  | 
def test_last(self):  | 
|
357  | 
self.assertInHistoryIs(1, 'r1', 'before:last:1')  | 
|
358  | 
||
359  | 
def test_alt_revid(self):  | 
|
| 
1948.4.13
by John Arbash Meinel
 Going before:0 is an error, and if you are on another history, use the leftmost parent  | 
360  | 
        # This will grab the left-most ancestor for alternate histories
 | 
361  | 
self.assertInHistoryIs(1, 'r1', 'before:revid:alt_r2')  | 
|
| 
1948.4.11
by John Arbash Meinel
 Update and test the tag: spec  | 
362  | 
|
| 
1948.4.14
by John Arbash Meinel
 Test the code path for a no-parent alternate history  | 
363  | 
def test_alt_no_parents(self):  | 
364  | 
new_tree = self.make_branch_and_tree('new_tree')  | 
|
365  | 
new_tree.commit('first', rev_id='new_r1')  | 
|
366  | 
self.tree.branch.repository.fetch(new_tree.branch.repository,  | 
|
367  | 
revision_id='new_r1')  | 
|
| 
2598.5.10
by Aaron Bentley
 Return NULL_REVISION instead of None for the null revision  | 
368  | 
self.assertInHistoryIs(0, 'null:', 'before:revid:new_r1')  | 
| 
1948.4.14
by John Arbash Meinel
 Test the code path for a no-parent alternate history  | 
369  | 
|
| 
3298.2.4
by John Arbash Meinel
 Introduce as_revision_id() as a function instead of in_branch(need_revno=False)  | 
370  | 
def test_as_revision_id(self):  | 
371  | 
self.assertAsRevisionId('r1', 'before:revid:r2')  | 
|
372  | 
self.assertAsRevisionId('r1', 'before:2')  | 
|
373  | 
self.assertAsRevisionId('r1', 'before:1.1.1')  | 
|
374  | 
self.assertAsRevisionId('r1', 'before:revid:alt_r2')  | 
|
375  | 
||
| 
1948.4.11
by John Arbash Meinel
 Update and test the tag: spec  | 
376  | 
|
377  | 
class TestRevisionSpec_tag(TestRevisionSpec):  | 
|
378  | 
||
| 
2220.2.3
by Martin Pool
 Add tag: revision namespace.  | 
379  | 
def make_branch_and_tree(self, relpath):  | 
380  | 
        # override format as the default one may not support tags
 | 
|
| 
3031.3.1
by Robert Collins
 Remove the unneeded ExperimentalBranch class.  | 
381  | 
return TestRevisionSpec.make_branch_and_tree(  | 
382  | 
self, relpath, format='dirstate-tags')  | 
|
| 
2220.2.3
by Martin Pool
 Add tag: revision namespace.  | 
383  | 
|
384  | 
def test_from_string_tag(self):  | 
|
385  | 
spec = RevisionSpec.from_string('tag:bzr-0.14')  | 
|
386  | 
self.assertIsInstance(spec, RevisionSpec_tag)  | 
|
387  | 
self.assertEqual(spec.spec, 'bzr-0.14')  | 
|
388  | 
||
389  | 
def test_lookup_tag(self):  | 
|
| 
2220.2.20
by Martin Pool
 Tag methods now available through Branch.tags.add_tag, etc  | 
390  | 
self.tree.branch.tags.set_tag('bzr-0.14', 'r1')  | 
| 
2220.2.3
by Martin Pool
 Add tag: revision namespace.  | 
391  | 
self.assertInHistoryIs(1, 'r1', 'tag:bzr-0.14')  | 
| 
3298.2.11
by Aaron Bentley
 Update tests for null:, clea up slightly  | 
392  | 
self.tree.branch.tags.set_tag('null_rev', 'null:')  | 
393  | 
self.assertInHistoryIs(0, 'null:', 'tag:null_rev')  | 
|
| 
2220.2.3
by Martin Pool
 Add tag: revision namespace.  | 
394  | 
|
395  | 
def test_failed_lookup(self):  | 
|
396  | 
        # tags that don't exist give a specific message: arguably we should
 | 
|
397  | 
        # just give InvalidRevisionSpec but I think this is more helpful
 | 
|
398  | 
self.assertRaises(errors.NoSuchTag,  | 
|
399  | 
self.get_in_history,  | 
|
400  | 
'tag:some-random-tag')  | 
|
| 
1948.4.12
by John Arbash Meinel
 Some tests for the date: spec  | 
401  | 
|
| 
3298.2.4
by John Arbash Meinel
 Introduce as_revision_id() as a function instead of in_branch(need_revno=False)  | 
402  | 
def test_as_revision_id(self):  | 
403  | 
self.tree.branch.tags.set_tag('my-tag', 'r2')  | 
|
| 
3298.2.11
by Aaron Bentley
 Update tests for null:, clea up slightly  | 
404  | 
self.tree.branch.tags.set_tag('null_rev', 'null:')  | 
| 
3298.2.4
by John Arbash Meinel
 Introduce as_revision_id() as a function instead of in_branch(need_revno=False)  | 
405  | 
self.assertAsRevisionId('r2', 'tag:my-tag')  | 
| 
3298.2.11
by Aaron Bentley
 Update tests for null:, clea up slightly  | 
406  | 
self.assertAsRevisionId('null:', 'tag:null_rev')  | 
| 
3298.2.4
by John Arbash Meinel
 Introduce as_revision_id() as a function instead of in_branch(need_revno=False)  | 
407  | 
self.assertAsRevisionId('r1', 'before:tag:my-tag')  | 
408  | 
||
| 
1948.4.12
by John Arbash Meinel
 Some tests for the date: spec  | 
409  | 
|
410  | 
class TestRevisionSpec_date(TestRevisionSpec):  | 
|
411  | 
||
412  | 
def setUp(self):  | 
|
413  | 
super(TestRevisionSpec, self).setUp()  | 
|
414  | 
||
415  | 
new_tree = self.make_branch_and_tree('new_tree')  | 
|
416  | 
new_tree.commit('Commit one', rev_id='new_r1',  | 
|
417  | 
timestamp=time.time() - 60*60*24)  | 
|
418  | 
new_tree.commit('Commit two', rev_id='new_r2')  | 
|
419  | 
new_tree.commit('Commit three', rev_id='new_r3')  | 
|
420  | 
||
421  | 
self.tree = new_tree  | 
|
422  | 
||
423  | 
def test_tomorrow(self):  | 
|
424  | 
self.assertInvalid('date:tomorrow')  | 
|
425  | 
||
426  | 
def test_today(self):  | 
|
427  | 
self.assertInHistoryIs(2, 'new_r2', 'date:today')  | 
|
428  | 
self.assertInHistoryIs(1, 'new_r1', 'before:date:today')  | 
|
429  | 
||
430  | 
def test_yesterday(self):  | 
|
431  | 
self.assertInHistoryIs(1, 'new_r1', 'date:yesterday')  | 
|
432  | 
||
433  | 
def test_invalid(self):  | 
|
| 
1948.4.15
by John Arbash Meinel
 Change the InvalidRevisionSpec formatting to be more readable  | 
434  | 
self.assertInvalid('date:foobar', extra='\ninvalid date')  | 
| 
1948.4.12
by John Arbash Meinel
 Some tests for the date: spec  | 
435  | 
        # You must have '-' between year/month/day
 | 
| 
1948.4.15
by John Arbash Meinel
 Change the InvalidRevisionSpec formatting to be more readable  | 
436  | 
self.assertInvalid('date:20040404', extra='\ninvalid date')  | 
| 
1948.4.12
by John Arbash Meinel
 Some tests for the date: spec  | 
437  | 
        # Need 2 digits for each date piece
 | 
| 
1948.4.15
by John Arbash Meinel
 Change the InvalidRevisionSpec formatting to be more readable  | 
438  | 
self.assertInvalid('date:2004-4-4', extra='\ninvalid date')  | 
| 
1948.4.12
by John Arbash Meinel
 Some tests for the date: spec  | 
439  | 
|
440  | 
def test_day(self):  | 
|
441  | 
now = datetime.datetime.now()  | 
|
442  | 
self.assertInHistoryIs(2, 'new_r2',  | 
|
443  | 
'date:%04d-%02d-%02d' % (now.year, now.month, now.day))  | 
|
| 
1948.4.17
by John Arbash Meinel
 Update tests for ancestor: spec  | 
444  | 
|
| 
3298.2.4
by John Arbash Meinel
 Introduce as_revision_id() as a function instead of in_branch(need_revno=False)  | 
445  | 
def test_as_revision_id(self):  | 
446  | 
self.assertAsRevisionId('new_r2', 'date:today')  | 
|
447  | 
||
| 
1948.4.17
by John Arbash Meinel
 Update tests for ancestor: spec  | 
448  | 
|
449  | 
class TestRevisionSpec_ancestor(TestRevisionSpec):  | 
|
450  | 
||
451  | 
def test_non_exact_branch(self):  | 
|
452  | 
        # It seems better to require an exact path to the branch
 | 
|
453  | 
        # Branch.open() rather than using Branch.open_containing()
 | 
|
454  | 
self.assertRaises(errors.NotBranchError,  | 
|
| 
1948.4.33
by John Arbash Meinel
 Switch from get_revision_spec() to RevisionSpec.from_string() (as advised by Martin)  | 
455  | 
self.get_in_history, 'ancestor:tree2/a')  | 
| 
1948.4.17
by John Arbash Meinel
 Update tests for ancestor: spec  | 
456  | 
|
457  | 
def test_simple(self):  | 
|
458  | 
        # Common ancestor of trees is 'alt_r2'
 | 
|
459  | 
self.assertInHistoryIs(None, 'alt_r2', 'ancestor:tree2')  | 
|
460  | 
||
461  | 
        # Going the other way, we get a valid revno
 | 
|
462  | 
tmp = self.tree  | 
|
463  | 
self.tree = self.tree2  | 
|
464  | 
self.tree2 = tmp  | 
|
465  | 
self.assertInHistoryIs(2, 'alt_r2', 'ancestor:tree')  | 
|
466  | 
||
467  | 
def test_self(self):  | 
|
468  | 
self.assertInHistoryIs(2, 'r2', 'ancestor:tree')  | 
|
469  | 
||
470  | 
def test_unrelated(self):  | 
|
471  | 
new_tree = self.make_branch_and_tree('new_tree')  | 
|
472  | 
||
473  | 
new_tree.commit('Commit one', rev_id='new_r1')  | 
|
474  | 
new_tree.commit('Commit two', rev_id='new_r2')  | 
|
475  | 
new_tree.commit('Commit three', rev_id='new_r3')  | 
|
476  | 
||
477  | 
        # With no common ancestor, we should raise another user error
 | 
|
478  | 
self.assertRaises(errors.NoCommonAncestor,  | 
|
| 
1948.4.33
by John Arbash Meinel
 Switch from get_revision_spec() to RevisionSpec.from_string() (as advised by Martin)  | 
479  | 
self.get_in_history, 'ancestor:new_tree')  | 
| 
1948.4.17
by John Arbash Meinel
 Update tests for ancestor: spec  | 
480  | 
|
481  | 
def test_no_commits(self):  | 
|
482  | 
new_tree = self.make_branch_and_tree('new_tree')  | 
|
483  | 
self.assertRaises(errors.NoCommits,  | 
|
| 
1948.4.33
by John Arbash Meinel
 Switch from get_revision_spec() to RevisionSpec.from_string() (as advised by Martin)  | 
484  | 
spec_in_history, 'ancestor:new_tree',  | 
485  | 
self.tree.branch)  | 
|
| 
1948.4.17
by John Arbash Meinel
 Update tests for ancestor: spec  | 
486  | 
|
487  | 
self.assertRaises(errors.NoCommits,  | 
|
| 
1948.4.33
by John Arbash Meinel
 Switch from get_revision_spec() to RevisionSpec.from_string() (as advised by Martin)  | 
488  | 
spec_in_history, 'ancestor:tree',  | 
489  | 
new_tree.branch)  | 
|
| 
1948.4.18
by John Arbash Meinel
 Update branch: spec and tests  | 
490  | 
|
| 
3298.2.4
by John Arbash Meinel
 Introduce as_revision_id() as a function instead of in_branch(need_revno=False)  | 
491  | 
def test_as_revision_id(self):  | 
492  | 
self.assertAsRevisionId('alt_r2', 'ancestor:tree2')  | 
|
493  | 
||
| 
1948.4.18
by John Arbash Meinel
 Update branch: spec and tests  | 
494  | 
|
495  | 
class TestRevisionSpec_branch(TestRevisionSpec):  | 
|
496  | 
||
497  | 
def test_non_exact_branch(self):  | 
|
498  | 
        # It seems better to require an exact path to the branch
 | 
|
499  | 
        # Branch.open() rather than using Branch.open_containing()
 | 
|
500  | 
self.assertRaises(errors.NotBranchError,  | 
|
| 
1948.4.33
by John Arbash Meinel
 Switch from get_revision_spec() to RevisionSpec.from_string() (as advised by Martin)  | 
501  | 
self.get_in_history, 'branch:tree2/a')  | 
| 
1948.4.18
by John Arbash Meinel
 Update branch: spec and tests  | 
502  | 
|
503  | 
def test_simple(self):  | 
|
504  | 
self.assertInHistoryIs(None, 'alt_r2', 'branch:tree2')  | 
|
505  | 
||
506  | 
def test_self(self):  | 
|
507  | 
self.assertInHistoryIs(2, 'r2', 'branch:tree')  | 
|
508  | 
||
509  | 
def test_unrelated(self):  | 
|
510  | 
new_tree = self.make_branch_and_tree('new_tree')  | 
|
511  | 
||
512  | 
new_tree.commit('Commit one', rev_id='new_r1')  | 
|
513  | 
new_tree.commit('Commit two', rev_id='new_r2')  | 
|
514  | 
new_tree.commit('Commit three', rev_id='new_r3')  | 
|
515  | 
||
516  | 
self.assertInHistoryIs(None, 'new_r3', 'branch:new_tree')  | 
|
517  | 
||
518  | 
        # XXX: Right now, we use fetch() to make sure the remote revisions
 | 
|
519  | 
        # have been pulled into the local branch. We may change that
 | 
|
520  | 
        # behavior in the future.
 | 
|
521  | 
self.failUnless(self.tree.branch.repository.has_revision('new_r3'))  | 
|
522  | 
||
523  | 
def test_no_commits(self):  | 
|
524  | 
new_tree = self.make_branch_and_tree('new_tree')  | 
|
525  | 
self.assertRaises(errors.NoCommits,  | 
|
| 
1948.4.33
by John Arbash Meinel
 Switch from get_revision_spec() to RevisionSpec.from_string() (as advised by Martin)  | 
526  | 
self.get_in_history, 'branch:new_tree')  | 
| 
1551.10.32
by Aaron Bentley
 Add submit: specifier, for merge-directive-like diffs  | 
527  | 
|
| 
3298.2.4
by John Arbash Meinel
 Introduce as_revision_id() as a function instead of in_branch(need_revno=False)  | 
528  | 
def test_as_revision_id(self):  | 
529  | 
self.assertAsRevisionId('alt_r2', 'branch:tree2')  | 
|
530  | 
||
| 
1551.10.32
by Aaron Bentley
 Add submit: specifier, for merge-directive-like diffs  | 
531  | 
|
532  | 
class TestRevisionSpec_submit(TestRevisionSpec):  | 
|
533  | 
||
534  | 
def test_submit_branch(self):  | 
|
535  | 
        # Common ancestor of trees is 'alt_r2'
 | 
|
536  | 
self.assertRaises(errors.NoSubmitBranch, self.get_in_history,  | 
|
537  | 
'submit:')  | 
|
538  | 
self.tree.branch.set_parent('../tree2')  | 
|
539  | 
self.assertInHistoryIs(None, 'alt_r2', 'submit:')  | 
|
540  | 
self.tree.branch.set_parent('bogus')  | 
|
541  | 
self.assertRaises(errors.NotBranchError, self.get_in_history,  | 
|
542  | 
'submit:')  | 
|
543  | 
        # submit branch overrides parent branch
 | 
|
544  | 
self.tree.branch.set_submit_branch('tree2')  | 
|
545  | 
self.assertInHistoryIs(None, 'alt_r2', 'submit:')  | 
|
| 
3298.2.3
by John Arbash Meinel
 Add tests that all RevisionSpecs implement in_branch(b, needs_revno)  | 
546  | 
|
| 
3298.2.4
by John Arbash Meinel
 Introduce as_revision_id() as a function instead of in_branch(need_revno=False)  | 
547  | 
def test_as_revision_id(self):  | 
548  | 
self.tree.branch.set_submit_branch('tree2')  | 
|
549  | 
self.assertAsRevisionId('alt_r2', 'branch:tree2')  |