/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
2297.1.2 by Martin Pool
Cleanup imports
1
# Copyright (C) 2005, 2006, 2007 Canonical Ltd
1553.5.71 by Martin Pool
Change branch format 5 to use LockDirs, not transport locks
2
#
1534.4.3 by Robert Collins
Implement BranchTestProviderAdapter, so tests now run across all branch formats.
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.
1553.5.71 by Martin Pool
Change branch format 5 to use LockDirs, not transport locks
7
#
1534.4.3 by Robert Collins
Implement BranchTestProviderAdapter, so tests now run across all branch formats.
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.
1553.5.71 by Martin Pool
Change branch format 5 to use LockDirs, not transport locks
12
#
1534.4.3 by Robert Collins
Implement BranchTestProviderAdapter, so tests now run across all branch formats.
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
17
"""Tests for the Branch facility that are not interface  tests.
18
1534.4.39 by Robert Collins
Basic BzrDir support.
19
For interface tests see tests/branch_implementations/*.py.
1534.4.3 by Robert Collins
Implement BranchTestProviderAdapter, so tests now run across all branch formats.
20
21
For concrete class tests see this file, and for meta-branch tests
22
also see this file.
23
"""
24
1534.4.7 by Robert Collins
Move downlevel check up to the Branch.open logic, removing it from the Branch constructor and deprecating relax_version_check to the same.
25
from StringIO import StringIO
1534.4.3 by Robert Collins
Implement BranchTestProviderAdapter, so tests now run across all branch formats.
26
2230.3.3 by Aaron Bentley
Add more config testing
27
from bzrlib import (
28
    branch as _mod_branch,
2230.3.44 by Aaron Bentley
Change asserts to specific errors for left-hand history violations
29
    bzrdir,
30
    errors,
2230.3.3 by Aaron Bentley
Add more config testing
31
    urlutils,
32
    )
2297.1.2 by Martin Pool
Cleanup imports
33
from bzrlib.branch import (
34
    Branch,
35
    BranchHooks,
36
    BranchFormat,
37
    BranchReferenceFormat,
38
    BzrBranch5,
39
    BzrBranchFormat5,
2297.1.3 by Martin Pool
PullResult can pretend to be an int for api compatibility with old .pull()
40
    PullResult,
2297.1.2 by Martin Pool
Cleanup imports
41
    )
1553.5.71 by Martin Pool
Change branch format 5 to use LockDirs, not transport locks
42
from bzrlib.bzrdir import (BzrDirMetaFormat1, BzrDirMeta1, 
43
                           BzrDir, BzrDirFormat)
1534.4.7 by Robert Collins
Move downlevel check up to the Branch.open logic, removing it from the Branch constructor and deprecating relax_version_check to the same.
44
from bzrlib.errors import (NotBranchError,
45
                           UnknownFormatError,
2245.1.3 by Robert Collins
Add install_hook to the BranchHooks class as the official means for installing a hook.
46
                           UnknownHook,
1534.4.7 by Robert Collins
Move downlevel check up to the Branch.open logic, removing it from the Branch constructor and deprecating relax_version_check to the same.
47
                           UnsupportedFormatError,
48
                           )
49
1534.4.44 by Robert Collins
Make a new BzrDir format that uses a versioned branch format in a branch/ subdirectory.
50
from bzrlib.tests import TestCase, TestCaseWithTransport
1534.4.4 by Robert Collins
Make BzrBranchFormat.find_format take a transport not a url for efficiency.
51
from bzrlib.transport import get_transport
1534.4.3 by Robert Collins
Implement BranchTestProviderAdapter, so tests now run across all branch formats.
52
1534.4.44 by Robert Collins
Make a new BzrDir format that uses a versioned branch format in a branch/ subdirectory.
53
class TestDefaultFormat(TestCase):
54
55
    def test_get_set_default_format(self):
2297.1.2 by Martin Pool
Cleanup imports
56
        old_format = BranchFormat.get_default_format()
1534.4.44 by Robert Collins
Make a new BzrDir format that uses a versioned branch format in a branch/ subdirectory.
57
        # default is 5
2297.1.2 by Martin Pool
Cleanup imports
58
        self.assertTrue(isinstance(old_format, BzrBranchFormat5))
59
        BranchFormat.set_default_format(SampleBranchFormat())
1534.4.44 by Robert Collins
Make a new BzrDir format that uses a versioned branch format in a branch/ subdirectory.
60
        try:
61
            # the default branch format is used by the meta dir format
62
            # which is not the default bzrdir format at this point
1685.1.42 by John Arbash Meinel
A couple more fixes to make sure memory:/// works correctly.
63
            dir = BzrDirMetaFormat1().initialize('memory:///')
1534.4.44 by Robert Collins
Make a new BzrDir format that uses a versioned branch format in a branch/ subdirectory.
64
            result = dir.create_branch()
65
            self.assertEqual(result, 'A branch')
66
        finally:
2297.1.2 by Martin Pool
Cleanup imports
67
            BranchFormat.set_default_format(old_format)
68
        self.assertEqual(old_format, BranchFormat.get_default_format())
1508.1.25 by Robert Collins
Update per review comments.
69
70
1553.5.71 by Martin Pool
Change branch format 5 to use LockDirs, not transport locks
71
class TestBranchFormat5(TestCaseWithTransport):
72
    """Tests specific to branch format 5"""
73
74
    def test_branch_format_5_uses_lockdir(self):
75
        url = self.get_url()
1553.5.72 by Martin Pool
Clean up test for Branch5 lockdirs
76
        bzrdir = BzrDirMetaFormat1().initialize(url)
77
        bzrdir.create_repository()
78
        branch = bzrdir.create_branch()
79
        t = self.get_transport()
80
        self.log("branch instance is %r" % branch)
81
        self.assert_(isinstance(branch, BzrBranch5))
82
        self.assertIsDirectory('.', t)
83
        self.assertIsDirectory('.bzr/branch', t)
84
        self.assertIsDirectory('.bzr/branch/lock', t)
1553.5.73 by Martin Pool
Additional test that Branch5 uses lockdir properly
85
        branch.lock_write()
1658.1.5 by Martin Pool
Release more locks taken during test suite
86
        try:
87
            self.assertIsDirectory('.bzr/branch/lock/held', t)
88
        finally:
89
            branch.unlock()
1553.5.71 by Martin Pool
Change branch format 5 to use LockDirs, not transport locks
90
2230.3.3 by Aaron Bentley
Add more config testing
91
    def test_set_push_location(self):
92
        from bzrlib.config import (locations_config_filename,
93
                                   ensure_config_dir_exists)
94
        ensure_config_dir_exists()
95
        fn = locations_config_filename()
96
        branch = self.make_branch('.', format='knit')
97
        branch.set_push_location('foo')
98
        local_path = urlutils.local_path_from_url(branch.base[:-1])
99
        self.assertFileEqual("[%s]\n"
100
                             "push_location = foo\n"
101
                             "push_location:policy = norecurse" % local_path,
102
                             fn)
103
2230.3.12 by Aaron Bentley
Clean up trailing whitespace
104
    # TODO RBC 20051029 test getting a push location from a branch in a
2230.3.3 by Aaron Bentley
Add more config testing
105
    # recursive section - that is, it appends the branch name.
106
1553.5.71 by Martin Pool
Change branch format 5 to use LockDirs, not transport locks
107
2297.1.2 by Martin Pool
Cleanup imports
108
class SampleBranchFormat(BranchFormat):
1534.4.44 by Robert Collins
Make a new BzrDir format that uses a versioned branch format in a branch/ subdirectory.
109
    """A sample format
110
111
    this format is initializable, unsupported to aid in testing the 
112
    open and open_downlevel routines.
113
    """
114
115
    def get_format_string(self):
116
        """See BzrBranchFormat.get_format_string()."""
117
        return "Sample branch format."
118
119
    def initialize(self, a_bzrdir):
120
        """Format 4 branches cannot be created."""
121
        t = a_bzrdir.get_branch_transport(self)
1955.3.9 by John Arbash Meinel
Find more occurrances of put() and replace with put_file or put_bytes
122
        t.put_bytes('format', self.get_format_string())
1534.4.44 by Robert Collins
Make a new BzrDir format that uses a versioned branch format in a branch/ subdirectory.
123
        return 'A branch'
124
125
    def is_supported(self):
126
        return False
127
128
    def open(self, transport, _found=False):
129
        return "opened branch."
130
131
132
class TestBzrBranchFormat(TestCaseWithTransport):
133
    """Tests for the BzrBranchFormat facility."""
134
135
    def test_find_format(self):
136
        # is the right format object found for a branch?
137
        # create a branch with a few known format objects.
138
        # this is not quite the same as 
139
        self.build_tree(["foo/", "bar/"])
140
        def check_format(format, url):
141
            dir = format._matchingbzrdir.initialize(url)
1534.4.47 by Robert Collins
Split out repository into .bzr/repository
142
            dir.create_repository()
1534.4.44 by Robert Collins
Make a new BzrDir format that uses a versioned branch format in a branch/ subdirectory.
143
            format.initialize(dir)
2297.1.2 by Martin Pool
Cleanup imports
144
            found_format = BranchFormat.find_format(dir)
1534.4.44 by Robert Collins
Make a new BzrDir format that uses a versioned branch format in a branch/ subdirectory.
145
            self.failUnless(isinstance(found_format, format.__class__))
2297.1.2 by Martin Pool
Cleanup imports
146
        check_format(BzrBranchFormat5(), "bar")
1534.4.44 by Robert Collins
Make a new BzrDir format that uses a versioned branch format in a branch/ subdirectory.
147
        
148
    def test_find_format_not_branch(self):
149
        dir = bzrdir.BzrDirMetaFormat1().initialize(self.get_url())
150
        self.assertRaises(NotBranchError,
2297.1.2 by Martin Pool
Cleanup imports
151
                          BranchFormat.find_format,
1534.4.44 by Robert Collins
Make a new BzrDir format that uses a versioned branch format in a branch/ subdirectory.
152
                          dir)
153
154
    def test_find_format_unknown_format(self):
155
        dir = bzrdir.BzrDirMetaFormat1().initialize(self.get_url())
156
        SampleBranchFormat().initialize(dir)
157
        self.assertRaises(UnknownFormatError,
2297.1.2 by Martin Pool
Cleanup imports
158
                          BranchFormat.find_format,
1534.4.44 by Robert Collins
Make a new BzrDir format that uses a versioned branch format in a branch/ subdirectory.
159
                          dir)
160
161
    def test_register_unregister_format(self):
162
        format = SampleBranchFormat()
163
        # make a control dir
164
        dir = bzrdir.BzrDirMetaFormat1().initialize(self.get_url())
165
        # make a branch
166
        format.initialize(dir)
167
        # register a format for it.
2297.1.2 by Martin Pool
Cleanup imports
168
        BranchFormat.register_format(format)
1534.4.44 by Robert Collins
Make a new BzrDir format that uses a versioned branch format in a branch/ subdirectory.
169
        # which branch.Open will refuse (not supported)
2297.1.2 by Martin Pool
Cleanup imports
170
        self.assertRaises(UnsupportedFormatError, Branch.open, self.get_url())
2230.3.22 by Aaron Bentley
Make test suite use format registry default, not BzrDir default
171
        self.make_branch_and_tree('foo')
1534.4.44 by Robert Collins
Make a new BzrDir format that uses a versioned branch format in a branch/ subdirectory.
172
        # but open_downlevel will work
1534.4.50 by Robert Collins
Got the bzrdir api straightened out, plenty of refactoring to use it pending, but the api is up and running.
173
        self.assertEqual(format.open(dir), bzrdir.BzrDir.open(self.get_url()).open_branch(unsupported=True))
1534.4.44 by Robert Collins
Make a new BzrDir format that uses a versioned branch format in a branch/ subdirectory.
174
        # unregister the format
2297.1.2 by Martin Pool
Cleanup imports
175
        BranchFormat.unregister_format(format)
2230.3.22 by Aaron Bentley
Make test suite use format registry default, not BzrDir default
176
        self.make_branch_and_tree('bar')
1534.4.50 by Robert Collins
Got the bzrdir api straightened out, plenty of refactoring to use it pending, but the api is up and running.
177
178
2230.3.1 by Aaron Bentley
Get branch6 creation working
179
class TestBranch6(TestCaseWithTransport):
180
181
    def test_creation(self):
182
        format = BzrDirMetaFormat1()
2230.3.55 by Aaron Bentley
Updates from review
183
        format.set_branch_format(_mod_branch.BzrBranchFormat6())
2230.3.1 by Aaron Bentley
Get branch6 creation working
184
        branch = self.make_branch('a', format=format)
185
        self.assertIsInstance(branch, _mod_branch.BzrBranch6)
1551.13.1 by Aaron Bentley
Introduce dirstate-tags format
186
        branch = self.make_branch('b', format='dirstate-tags')
2230.3.1 by Aaron Bentley
Get branch6 creation working
187
        self.assertIsInstance(branch, _mod_branch.BzrBranch6)
188
        branch = _mod_branch.Branch.open('a')
189
        self.assertIsInstance(branch, _mod_branch.BzrBranch6)
190
191
    def test_layout(self):
1551.13.1 by Aaron Bentley
Introduce dirstate-tags format
192
        branch = self.make_branch('a', format='dirstate-tags')
2230.3.1 by Aaron Bentley
Get branch6 creation working
193
        self.failUnlessExists('a/.bzr/branch/last-revision')
194
        self.failIfExists('a/.bzr/branch/revision-history')
195
2230.3.3 by Aaron Bentley
Add more config testing
196
    def test_config(self):
197
        """Ensure that all configuration data is stored in the branch"""
1551.13.1 by Aaron Bentley
Introduce dirstate-tags format
198
        branch = self.make_branch('a', format='dirstate-tags')
2230.3.3 by Aaron Bentley
Add more config testing
199
        branch.set_parent('http://bazaar-vcs.org')
200
        self.failIfExists('a/.bzr/branch/parent')
201
        self.assertEqual('http://bazaar-vcs.org', branch.get_parent())
202
        branch.set_push_location('sftp://bazaar-vcs.org')
203
        config = branch.get_config()._get_branch_data_config()
2230.3.12 by Aaron Bentley
Clean up trailing whitespace
204
        self.assertEqual('sftp://bazaar-vcs.org',
2230.3.3 by Aaron Bentley
Add more config testing
205
                         config.get_user_option('push_location'))
206
        branch.set_bound_location('ftp://bazaar-vcs.org')
207
        self.failIfExists('a/.bzr/branch/bound')
208
        self.assertEqual('ftp://bazaar-vcs.org', branch.get_bound_location())
209
2230.3.44 by Aaron Bentley
Change asserts to specific errors for left-hand history violations
210
    def test_set_revision_history(self):
211
        tree = self.make_branch_and_memory_tree('.',
1551.13.1 by Aaron Bentley
Introduce dirstate-tags format
212
            format='dirstate-tags')
2230.3.44 by Aaron Bentley
Change asserts to specific errors for left-hand history violations
213
        tree.lock_write()
214
        try:
215
            tree.add('.')
216
            tree.commit('foo', rev_id='foo')
217
            tree.commit('bar', rev_id='bar')
218
            tree.branch.set_revision_history(['foo', 'bar'])
219
            tree.branch.set_revision_history(['foo'])
220
            self.assertRaises(errors.NotLefthandHistory,
221
                              tree.branch.set_revision_history, ['bar'])
222
        finally:
223
            tree.unlock()
224
225
    def test_append_revision(self):
226
        tree = self.make_branch_and_tree('branch1',
1551.13.1 by Aaron Bentley
Introduce dirstate-tags format
227
            format='dirstate-tags')
2230.3.44 by Aaron Bentley
Change asserts to specific errors for left-hand history violations
228
        tree.lock_write()
229
        try:
230
            tree.commit('foo', rev_id='foo')
231
            tree.commit('bar', rev_id='bar')
232
            tree.commit('baz', rev_id='baz')
233
            tree.set_last_revision('bar')
2230.3.51 by Aaron Bentley
Store revno for Branch6, set_last_revision -> set_last_revision_info
234
            tree.branch.set_last_revision_info(2, 'bar')
2230.3.44 by Aaron Bentley
Change asserts to specific errors for left-hand history violations
235
            tree.commit('qux', rev_id='qux')
236
            tree.add_parent_tree_id('baz')
237
            tree.commit('qux', rev_id='quxx')
2230.3.51 by Aaron Bentley
Store revno for Branch6, set_last_revision -> set_last_revision_info
238
            tree.branch.set_last_revision_info(0, 'null:')
2230.3.44 by Aaron Bentley
Change asserts to specific errors for left-hand history violations
239
            self.assertRaises(errors.NotLeftParentDescendant,
240
                              tree.branch.append_revision, 'bar')
241
            tree.branch.append_revision('foo')
242
            self.assertRaises(errors.NotLeftParentDescendant,
243
                              tree.branch.append_revision, 'baz')
244
            tree.branch.append_revision('bar')
245
            tree.branch.append_revision('baz')
246
            self.assertRaises(errors.NotLeftParentDescendant,
247
                              tree.branch.append_revision, 'quxx')
248
        finally:
249
            tree.unlock()
2230.3.51 by Aaron Bentley
Store revno for Branch6, set_last_revision -> set_last_revision_info
250
2100.3.26 by Aaron Bentley
checkout type is maintained for subtrees
251
    def do_checkout_test(self, lightweight=False):
2255.2.194 by Robert Collins
[BROKEN] Many updates to stop using experimental formats in tests.
252
        tree = self.make_branch_and_tree('source', format='dirstate-with-subtree')
253
        subtree = self.make_branch_and_tree('source/subtree',
254
            format='dirstate-with-subtree')
2100.3.25 by Aaron Bentley
add subsubtree to test
255
        subsubtree = self.make_branch_and_tree('source/subtree/subsubtree',
2255.2.194 by Robert Collins
[BROKEN] Many updates to stop using experimental formats in tests.
256
            format='dirstate-with-subtree')
2100.3.25 by Aaron Bentley
add subsubtree to test
257
        self.build_tree(['source/subtree/file',
258
                         'source/subtree/subsubtree/file'])
259
        subsubtree.add('file')
2100.3.21 by Aaron Bentley
Work on checking out by-reference trees
260
        subtree.add('file')
2100.3.25 by Aaron Bentley
add subsubtree to test
261
        subtree.add_reference(subsubtree)
2100.3.21 by Aaron Bentley
Work on checking out by-reference trees
262
        tree.add_reference(subtree)
263
        tree.commit('a revision')
2100.3.23 by Aaron Bentley
Nested checkouts kinda work
264
        subtree.commit('a subtree file')
2100.3.25 by Aaron Bentley
add subsubtree to test
265
        subsubtree.commit('a subsubtree file')
2100.3.26 by Aaron Bentley
checkout type is maintained for subtrees
266
        tree.branch.create_checkout('target', lightweight=lightweight)
2100.3.21 by Aaron Bentley
Work on checking out by-reference trees
267
        self.failUnlessExists('target')
268
        self.failUnlessExists('target/subtree')
269
        self.failUnlessExists('target/subtree/file')
2100.3.25 by Aaron Bentley
add subsubtree to test
270
        self.failUnlessExists('target/subtree/subsubtree/file')
2100.3.31 by Aaron Bentley
Merged bzr.dev (17 tests failing)
271
        subbranch = _mod_branch.Branch.open('target/subtree/subsubtree')
2100.3.26 by Aaron Bentley
checkout type is maintained for subtrees
272
        if lightweight:
273
            self.assertEndsWith(subbranch.base, 'source/subtree/subsubtree/')
274
        else:
275
            self.assertEndsWith(subbranch.base, 'target/subtree/subsubtree/')
276
277
278
    def test_checkout_with_references(self):
279
        self.do_checkout_test()
280
281
    def test_light_checkout_with_references(self):
282
        self.do_checkout_test(lightweight=True)
2230.3.51 by Aaron Bentley
Store revno for Branch6, set_last_revision -> set_last_revision_info
283
1534.4.50 by Robert Collins
Got the bzrdir api straightened out, plenty of refactoring to use it pending, but the api is up and running.
284
class TestBranchReference(TestCaseWithTransport):
285
    """Tests for the branch reference facility."""
286
287
    def test_create_open_reference(self):
288
        bzrdirformat = bzrdir.BzrDirMetaFormat1()
289
        t = get_transport(self.get_url('.'))
290
        t.mkdir('repo')
291
        dir = bzrdirformat.initialize(self.get_url('repo'))
292
        dir.create_repository()
293
        target_branch = dir.create_branch()
294
        t.mkdir('branch')
295
        branch_dir = bzrdirformat.initialize(self.get_url('branch'))
2297.1.2 by Martin Pool
Cleanup imports
296
        made_branch = BranchReferenceFormat().initialize(branch_dir, target_branch)
1534.4.50 by Robert Collins
Got the bzrdir api straightened out, plenty of refactoring to use it pending, but the api is up and running.
297
        self.assertEqual(made_branch.base, target_branch.base)
298
        opened_branch = branch_dir.open_branch()
299
        self.assertEqual(opened_branch.base, target_branch.base)
2245.1.1 by Robert Collins
New Branch hooks facility, with one initial hook 'set_rh' which triggers
300
301
302
class TestHooks(TestCase):
303
2245.1.2 by Robert Collins
Remove the static DefaultHooks method from Branch, replacing it with a derived dict BranchHooks object, which is easier to use and provides a place to put the policy-checking add method discussed on list.
304
    def test_constructor(self):
305
        """Check that creating a BranchHooks instance has the right defaults."""
2297.1.2 by Martin Pool
Cleanup imports
306
        hooks = BranchHooks()
2245.1.2 by Robert Collins
Remove the static DefaultHooks method from Branch, replacing it with a derived dict BranchHooks object, which is easier to use and provides a place to put the policy-checking add method discussed on list.
307
        self.assertTrue("set_rh" in hooks, "set_rh not in %s" % hooks)
2246.1.3 by Robert Collins
New branch hooks: post_push, post_pull, post_commit, post_uncommit. These
308
        self.assertTrue("post_push" in hooks, "post_push not in %s" % hooks)
309
        self.assertTrue("post_commit" in hooks, "post_commit not in %s" % hooks)
310
        self.assertTrue("post_pull" in hooks, "post_pull not in %s" % hooks)
311
        self.assertTrue("post_uncommit" in hooks, "post_uncommit not in %s" % hooks)
2245.1.1 by Robert Collins
New Branch hooks facility, with one initial hook 'set_rh' which triggers
312
2245.1.2 by Robert Collins
Remove the static DefaultHooks method from Branch, replacing it with a derived dict BranchHooks object, which is easier to use and provides a place to put the policy-checking add method discussed on list.
313
    def test_installed_hooks_are_BranchHooks(self):
314
        """The installed hooks object should be a BranchHooks."""
315
        # the installed hooks are saved in self._preserved_hooks.
2297.1.2 by Martin Pool
Cleanup imports
316
        self.assertIsInstance(self._preserved_hooks, BranchHooks)
2245.1.3 by Robert Collins
Add install_hook to the BranchHooks class as the official means for installing a hook.
317
318
    def test_install_hook_raises_unknown_hook(self):
319
        """install_hook should raise UnknownHook if a hook is unknown."""
2297.1.2 by Martin Pool
Cleanup imports
320
        hooks = BranchHooks()
2245.1.3 by Robert Collins
Add install_hook to the BranchHooks class as the official means for installing a hook.
321
        self.assertRaises(UnknownHook, hooks.install_hook, 'silly', None)
322
323
    def test_install_hook_appends_known_hook(self):
324
        """install_hook should append the callable for known hooks."""
2297.1.2 by Martin Pool
Cleanup imports
325
        hooks = BranchHooks()
2245.1.3 by Robert Collins
Add install_hook to the BranchHooks class as the official means for installing a hook.
326
        hooks.install_hook('set_rh', None)
327
        self.assertEqual(hooks['set_rh'], [None])
2297.1.3 by Martin Pool
PullResult can pretend to be an int for api compatibility with old .pull()
328
329
330
class TestPullResult(TestCase):
331
332
    def test_pull_result_to_int(self):
333
        # to support old code, the pull result can be used as an int
334
        r = PullResult()
335
        r.old_revno = 10
336
        r.new_revno = 20
337
        # this usage of results is not recommended for new code (because it
338
        # doesn't describe very well what happened), but for api stability
339
        # it's still supported
340
        a = "%d revisions pulled" % r
341
        self.assertEqual(a, "10 revisions pulled")