~bzr-pqm/bzr/bzr.dev

2052.3.2 by John Arbash Meinel
Change Copyright .. by Canonical to Copyright ... Canonical
1
# Copyright (C) 2005 Canonical Ltd
1887.1.1 by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines,
2
#
1505.1.1 by John Arbash Meinel
Adding test for bound behavior
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
#
1505.1.1 by John Arbash Meinel
Adding test for bound behavior
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
#
1505.1.1 by John Arbash Meinel
Adding test for bound behavior
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
1997.1.5 by Robert Collins
``Branch.bind(other_branch)`` no longer takes a write lock on the
18
"""Tests of bound branches (binding, unbinding, commit, etc) command."""
1505.1.1 by John Arbash Meinel
Adding test for bound behavior
19
20
import os
21
from cStringIO import StringIO
22
2204.4.13 by Aaron Bentley
Update all test cases to avoid set_default_format
23
from bzrlib import (
24
    bzrdir,
25
    )
1505.1.1 by John Arbash Meinel
Adding test for bound behavior
26
from bzrlib.branch import Branch
1694.2.6 by Martin Pool
[merge] bzr.dev
27
from bzrlib.bzrdir import (BzrDir, BzrDirFormat, BzrDirMetaFormat1)
1685.1.45 by John Arbash Meinel
Moved url functions into bzrlib.urlutils
28
from bzrlib.osutils import getcwd
29
from bzrlib.tests import TestCaseWithTransport
30
import bzrlib.urlutils as urlutils
1587.1.6 by Robert Collins
Update bound branch implementation to 0.8.
31
from bzrlib.workingtree import WorkingTree
32
33
34
class TestLegacyFormats(TestCaseWithTransport):
35
    
36
    def setUp(self):
37
        super(TestLegacyFormats, self).setUp()
38
        self.build_tree(['master/', 'child/'])
39
        self.run_bzr('init', 'master')
1857.1.20 by Aaron Bentley
Strip out all the EnumOption stuff
40
        self.run_bzr('init', '--format=weave', 'child')
1587.1.6 by Robert Collins
Update bound branch implementation to 0.8.
41
        os.chdir('child')
42
    
43
    def test_bind_format_6_bzrdir(self):
44
        # bind on a format 6 bzrdir should error
45
        out,err = self.run_bzr('bind', '../master', retcode=3)
46
        self.assertEqual('', out)
1685.1.34 by John Arbash Meinel
Another test which assumed the output was a local path not a url
47
        # TODO: jam 20060427 Probably something like this really should
48
        #       print out the actual path, rather than the URL
1685.1.45 by John Arbash Meinel
Moved url functions into bzrlib.urlutils
49
        cwd = urlutils.local_path_to_url(getcwd())
1587.1.6 by Robert Collins
Update bound branch implementation to 0.8.
50
        self.assertEqual('bzr: ERROR: To use this feature you must '
1685.1.34 by John Arbash Meinel
Another test which assumed the output was a local path not a url
51
                         'upgrade your branch at %s/.\n' % cwd, err)
1587.1.6 by Robert Collins
Update bound branch implementation to 0.8.
52
    
53
    def test_unbind_format_6_bzrdir(self):
54
        # bind on a format 6 bzrdir should error
55
        out,err = self.run_bzr('unbind', retcode=3)
56
        self.assertEqual('', out)
1685.1.45 by John Arbash Meinel
Moved url functions into bzrlib.urlutils
57
        cwd = urlutils.local_path_to_url(getcwd())
1587.1.6 by Robert Collins
Update bound branch implementation to 0.8.
58
        self.assertEqual('bzr: ERROR: To use this feature you must '
1685.1.34 by John Arbash Meinel
Another test which assumed the output was a local path not a url
59
                         'upgrade your branch at %s/.\n' % cwd, err)
1587.1.6 by Robert Collins
Update bound branch implementation to 0.8.
60
61
62
class TestBoundBranches(TestCaseWithTransport):
63
1505.1.1 by John Arbash Meinel
Adding test for bound behavior
64
    def create_branches(self):
1505.1.6 by John Arbash Meinel
Cleaned up tests and code, all bound branch tests succeed.
65
        bzr = self.run_bzr
1505.1.1 by John Arbash Meinel
Adding test for bound behavior
66
        self.build_tree(['base/', 'base/a', 'base/b'])
67
1607.1.14 by Robert Collins
Reduce lock thrashing somewhat - drops bound branch tests lock count from 6554 to 4456 locks.
68
        branch = self.init_meta_branch('base')
69
        tree = branch.bzrdir.open_workingtree()
70
        tree.lock_write()
71
        tree.add(['a', 'b'])
72
        tree.commit('init')
73
        tree.unlock()
74
75
        self.run_bzr('checkout', 'base', 'child')
1505.1.1 by John Arbash Meinel
Adding test for bound behavior
76
1505.1.24 by John Arbash Meinel
Updated commit to handle bound branches. Included test to handle commit after merge
77
        self.check_revno(1, 'child')
1587.1.6 by Robert Collins
Update bound branch implementation to 0.8.
78
        d = BzrDir.open('child')
79
        self.assertNotEqual(None, d.open_branch().get_master_branch())
1505.1.1 by John Arbash Meinel
Adding test for bound behavior
80
1607.1.14 by Robert Collins
Reduce lock thrashing somewhat - drops bound branch tests lock count from 6554 to 4456 locks.
81
    def check_revno(self, val, loc='.'):
82
        self.assertEqual(
83
            val, len(BzrDir.open(loc).open_branch().revision_history()))
1505.1.1 by John Arbash Meinel
Adding test for bound behavior
84
1505.1.4 by John Arbash Meinel
Wrote a simple test which actually makes a branch become bound, and made it work
85
    def test_simple_binding(self):
86
        self.build_tree(['base/', 'base/a', 'base/b'])
87
1587.1.6 by Robert Collins
Update bound branch implementation to 0.8.
88
        self.init_meta_branch('base')
89
        self.run_bzr('add', 'base')
90
        self.run_bzr('commit', '-m', 'init', 'base')
1505.1.4 by John Arbash Meinel
Wrote a simple test which actually makes a branch become bound, and made it work
91
1587.1.6 by Robert Collins
Update bound branch implementation to 0.8.
92
        self.run_bzr('branch', 'base', 'child')
1505.1.4 by John Arbash Meinel
Wrote a simple test which actually makes a branch become bound, and made it work
93
94
        os.chdir('child')
1587.1.6 by Robert Collins
Update bound branch implementation to 0.8.
95
        self.run_bzr('bind', '../base')
96
97
        d = BzrDir.open('')
98
        self.assertNotEqual(None, d.open_branch().get_master_branch())
99
100
        self.run_bzr('unbind')
101
        self.assertEqual(None, d.open_branch().get_master_branch())
102
103
        self.run_bzr('unbind', retcode=3)
104
2230.3.31 by Aaron Bentley
Implement re-binding previously-bound branches
105
    def test_bind_branch6(self):
1551.13.1 by Aaron Bentley
Introduce dirstate-tags format
106
        branch1 = self.make_branch('branch1', format='dirstate-tags')
2230.3.31 by Aaron Bentley
Implement re-binding previously-bound branches
107
        os.chdir('branch1')
108
        error = self.run_bzr('bind', retcode=3)[1]
2230.3.48 by Aaron Bentley
Update blackbox test to handle new error message
109
        self.assertContainsRe(error, 'no previous location known')
2230.3.31 by Aaron Bentley
Implement re-binding previously-bound branches
110
111
    def setup_rebind(self, format):
112
        branch1 = self.make_branch('branch1')
113
        branch2 = self.make_branch('branch2', format=format)
114
        branch2.bind(branch1)
115
        branch2.unbind()
116
117
    def test_rebind_branch6(self):
1551.13.1 by Aaron Bentley
Introduce dirstate-tags format
118
        self.setup_rebind('dirstate-tags')
2230.3.31 by Aaron Bentley
Implement re-binding previously-bound branches
119
        os.chdir('branch2')
120
        self.run_bzr('bind')
121
        b = Branch.open('.')
122
        self.assertContainsRe(b.get_bound_location(), '\/branch1\/$')
123
124
    def test_rebind_branch5(self):
125
        self.setup_rebind('knit')
126
        os.chdir('branch2')
127
        error = self.run_bzr('bind', retcode=3)[1]
128
        self.assertContainsRe(error, 'old locations')
129
1587.1.6 by Robert Collins
Update bound branch implementation to 0.8.
130
    def init_meta_branch(self, path):
2323.6.3 by Martin Pool
bound-branch ui tests should now use the default branch format
131
        format = bzrdir.format_registry.make_bzrdir('default')
2204.4.13 by Aaron Bentley
Update all test cases to avoid set_default_format
132
        return BzrDir.create_branch_convenience(path, format=format)
1505.1.5 by John Arbash Meinel
Added a test for the unbind command.
133
1505.1.1 by John Arbash Meinel
Adding test for bound behavior
134
    def test_bound_commit(self):
135
        bzr = self.run_bzr
136
        self.create_branches()
137
138
        os.chdir('child')
139
        open('a', 'wb').write('new contents\n')
140
        bzr('commit', '-m', 'child')
141
1505.1.3 by John Arbash Meinel
(broken) Adding more tests, and some functionality
142
        self.check_revno(2)
1505.1.1 by John Arbash Meinel
Adding test for bound behavior
143
144
        # Make sure it committed on the parent
1505.1.24 by John Arbash Meinel
Updated commit to handle bound branches. Included test to handle commit after merge
145
        self.check_revno(2, '../base')
1505.1.1 by John Arbash Meinel
Adding test for bound behavior
146
1505.1.4 by John Arbash Meinel
Wrote a simple test which actually makes a branch become bound, and made it work
147
    def test_bound_fail(self):
1505.1.26 by John Arbash Meinel
Created a set of tests which bind to an sftp branch. Found some bugs, need to fix commit.
148
        # Make sure commit fails if out of date.
1505.1.1 by John Arbash Meinel
Adding test for bound behavior
149
        bzr = self.run_bzr
150
        self.create_branches()
151
152
        os.chdir('base')
153
        open('a', 'wb').write('new base contents\n')
154
        bzr('commit', '-m', 'base')
1587.1.11 by Robert Collins
Local commits appear to be working properly.
155
        self.check_revno(2)
1505.1.1 by John Arbash Meinel
Adding test for bound behavior
156
157
        os.chdir('../child')
1587.1.11 by Robert Collins
Local commits appear to be working properly.
158
        self.check_revno(1)
1505.1.1 by John Arbash Meinel
Adding test for bound behavior
159
        open('b', 'wb').write('new b child contents\n')
1505.1.16 by John Arbash Meinel
[merge] robertc's integration, updated tests to check for retcode=3
160
        bzr('commit', '-m', 'child', retcode=3)
1587.1.11 by Robert Collins
Local commits appear to be working properly.
161
        self.check_revno(1)
1505.1.1 by John Arbash Meinel
Adding test for bound behavior
162
1505.1.13 by John Arbash Meinel
Adding the bzr update command, to update checkouts and bound branches.
163
        bzr('update')
1505.1.3 by John Arbash Meinel
(broken) Adding more tests, and some functionality
164
        self.check_revno(2)
1505.1.1 by John Arbash Meinel
Adding test for bound behavior
165
166
        bzr('commit', '-m', 'child')
1505.1.3 by John Arbash Meinel
(broken) Adding more tests, and some functionality
167
        self.check_revno(3)
1505.1.24 by John Arbash Meinel
Updated commit to handle bound branches. Included test to handle commit after merge
168
        self.check_revno(3, '../base')
1505.1.1 by John Arbash Meinel
Adding test for bound behavior
169
1505.1.2 by John Arbash Meinel
(broken) working on implementing bound branches.
170
    def test_double_binding(self):
171
        bzr = self.run_bzr
172
        self.create_branches()
173
174
        bzr('branch', 'child', 'child2')
175
        os.chdir('child2')
176
1505.1.6 by John Arbash Meinel
Cleaned up tests and code, all bound branch tests succeed.
177
        # Double binding succeeds, but committing to child2 should fail
178
        bzr('bind', '../child')
1505.1.2 by John Arbash Meinel
(broken) working on implementing bound branches.
179
1505.1.16 by John Arbash Meinel
[merge] robertc's integration, updated tests to check for retcode=3
180
        bzr('commit', '-m', 'child2', '--unchanged', retcode=3)
1505.1.2 by John Arbash Meinel
(broken) working on implementing bound branches.
181
1505.1.1 by John Arbash Meinel
Adding test for bound behavior
182
    def test_unbinding(self):
183
        bzr = self.run_bzr
184
        self.create_branches()
185
186
        os.chdir('base')
187
        open('a', 'wb').write('new base contents\n')
188
        bzr('commit', '-m', 'base')
1505.1.3 by John Arbash Meinel
(broken) Adding more tests, and some functionality
189
        self.check_revno(2)
1505.1.1 by John Arbash Meinel
Adding test for bound behavior
190
191
        os.chdir('../child')
192
        open('b', 'wb').write('new b child contents\n')
1505.1.3 by John Arbash Meinel
(broken) Adding more tests, and some functionality
193
        self.check_revno(1)
1505.1.16 by John Arbash Meinel
[merge] robertc's integration, updated tests to check for retcode=3
194
        bzr('commit', '-m', 'child', retcode=3)
1505.1.3 by John Arbash Meinel
(broken) Adding more tests, and some functionality
195
        self.check_revno(1)
1505.1.1 by John Arbash Meinel
Adding test for bound behavior
196
        bzr('unbind')
197
        bzr('commit', '-m', 'child')
1505.1.3 by John Arbash Meinel
(broken) Adding more tests, and some functionality
198
        self.check_revno(2)
1505.1.1 by John Arbash Meinel
Adding test for bound behavior
199
1505.1.16 by John Arbash Meinel
[merge] robertc's integration, updated tests to check for retcode=3
200
        bzr('bind', retcode=3)
1505.1.3 by John Arbash Meinel
(broken) Adding more tests, and some functionality
201
202
    def test_commit_remote_bound(self):
203
        # It is not possible to commit to a branch
204
        # which is bound to a branch which is bound
205
        bzr = self.run_bzr
1505.1.6 by John Arbash Meinel
Cleaned up tests and code, all bound branch tests succeed.
206
        self.create_branches()
1505.1.3 by John Arbash Meinel
(broken) Adding more tests, and some functionality
207
        bzr('branch', 'base', 'newbase')
208
        os.chdir('base')
209
        
210
        # There is no way to know that B has already
211
        # been bound by someone else, otherwise it
212
        # might be nice if this would fail
213
        bzr('bind', '../newbase')
214
215
        os.chdir('../child')
1505.1.16 by John Arbash Meinel
[merge] robertc's integration, updated tests to check for retcode=3
216
        bzr('commit', '-m', 'failure', '--unchanged', retcode=3)
1505.1.3 by John Arbash Meinel
(broken) Adding more tests, and some functionality
217
218
    def test_pull_updates_both(self):
219
        bzr = self.run_bzr
220
        self.create_branches()
221
        bzr('branch', 'base', 'newchild')
222
        os.chdir('newchild')
223
        open('b', 'wb').write('newchild b contents\n')
224
        bzr('commit', '-m', 'newchild')
225
        self.check_revno(2)
226
227
        os.chdir('../child')
228
        # The pull should succeed, and update
229
        # the bound parent branch
230
        bzr('pull', '../newchild')
231
        self.check_revno(2)
232
1505.1.24 by John Arbash Meinel
Updated commit to handle bound branches. Included test to handle commit after merge
233
        self.check_revno(2, '../base')
1505.1.3 by John Arbash Meinel
(broken) Adding more tests, and some functionality
234
235
    def test_bind_diverged(self):
236
        bzr = self.run_bzr
237
        self.create_branches()
238
239
        os.chdir('child')
240
        bzr('unbind')
241
242
        bzr('commit', '-m', 'child', '--unchanged')
243
        self.check_revno(2)
244
245
        os.chdir('../base')
246
        self.check_revno(1)
247
        bzr('commit', '-m', 'base', '--unchanged')
248
        self.check_revno(2)
249
250
        os.chdir('../child')
251
        # These branches have diverged
1505.1.16 by John Arbash Meinel
[merge] robertc's integration, updated tests to check for retcode=3
252
        bzr('bind', '../base', retcode=3)
1505.1.3 by John Arbash Meinel
(broken) Adding more tests, and some functionality
253
254
        # TODO: In the future, this might require actual changes
255
        # to have occurred, rather than just a new revision entry
256
        bzr('merge', '../base')
257
        bzr('commit', '-m', 'merged')
258
        self.check_revno(3)
259
1997.1.5 by Robert Collins
``Branch.bind(other_branch)`` no longer takes a write lock on the
260
        # After binding, the revision history should be unaltered
261
        base_branch = Branch.open('../base')
262
        child_branch = Branch.open('.')
263
        # take a copy before
264
        base_history = base_branch.revision_history()
265
        child_history = child_branch.revision_history()
266
1505.1.13 by John Arbash Meinel
Adding the bzr update command, to update checkouts and bound branches.
267
        # After a merge, trying to bind again should succeed
1997.1.5 by Robert Collins
``Branch.bind(other_branch)`` no longer takes a write lock on the
268
        # keeping the new change as a local commit.
1505.1.3 by John Arbash Meinel
(broken) Adding more tests, and some functionality
269
        bzr('bind', '../base')
1505.1.13 by John Arbash Meinel
Adding the bzr update command, to update checkouts and bound branches.
270
        self.check_revno(3)
1997.1.5 by Robert Collins
``Branch.bind(other_branch)`` no longer takes a write lock on the
271
        self.check_revno(2, '../base')
1505.1.3 by John Arbash Meinel
(broken) Adding more tests, and some functionality
272
1997.1.5 by Robert Collins
``Branch.bind(other_branch)`` no longer takes a write lock on the
273
        # and compare the revision history now
274
        self.assertEqual(base_history, base_branch.revision_history())
275
        self.assertEqual(child_history, child_branch.revision_history())
1505.1.3 by John Arbash Meinel
(broken) Adding more tests, and some functionality
276
277
    def test_bind_parent_ahead(self):
278
        bzr = self.run_bzr
279
        self.create_branches()
280
281
        os.chdir('child')
282
        bzr('unbind')
283
284
        os.chdir('../base')
285
        bzr('commit', '-m', 'base', '--unchanged')
286
287
        os.chdir('../child')
288
        self.check_revno(1)
289
        bzr('bind', '../base')
290
1997.1.5 by Robert Collins
``Branch.bind(other_branch)`` no longer takes a write lock on the
291
        # binding does not pull data:
292
        self.check_revno(1)
1505.1.11 by John Arbash Meinel
Adding a little bit more to the test suite.
293
        bzr('unbind')
294
295
        # Check and make sure it also works if parent is ahead multiple
296
        os.chdir('../base')
297
        bzr('commit', '-m', 'base 3', '--unchanged')
298
        bzr('commit', '-m', 'base 4', '--unchanged')
299
        bzr('commit', '-m', 'base 5', '--unchanged')
300
        self.check_revno(5)
301
302
        os.chdir('../child')
1997.1.5 by Robert Collins
``Branch.bind(other_branch)`` no longer takes a write lock on the
303
        self.check_revno(1)
1587.1.14 by Robert Collins
Make bound branch creation happen via 'checkout'
304
        bzr('bind', '../base')
1997.1.5 by Robert Collins
``Branch.bind(other_branch)`` no longer takes a write lock on the
305
        self.check_revno(1)
1505.1.3 by John Arbash Meinel
(broken) Adding more tests, and some functionality
306
307
    def test_bind_child_ahead(self):
1607.1.14 by Robert Collins
Reduce lock thrashing somewhat - drops bound branch tests lock count from 6554 to 4456 locks.
308
        # test binding when the master branches history is a prefix of the 
1997.1.5 by Robert Collins
``Branch.bind(other_branch)`` no longer takes a write lock on the
309
        # childs - it should bind ok but the revision histories should not
310
        # be altered
1505.1.3 by John Arbash Meinel
(broken) Adding more tests, and some functionality
311
        bzr = self.run_bzr
312
        self.create_branches()
313
314
        os.chdir('child')
315
        bzr('unbind')
316
        bzr('commit', '-m', 'child', '--unchanged')
317
        self.check_revno(2)
318
        self.check_revno(1, '../base')
319
320
        bzr('bind', '../base')
1997.1.5 by Robert Collins
``Branch.bind(other_branch)`` no longer takes a write lock on the
321
        self.check_revno(1, '../base')
1505.1.1 by John Arbash Meinel
Adding test for bound behavior
322
1505.1.11 by John Arbash Meinel
Adding a little bit more to the test suite.
323
        # Check and make sure it also works if child is ahead multiple
324
        bzr('unbind')
325
        bzr('commit', '-m', 'child 3', '--unchanged')
326
        bzr('commit', '-m', 'child 4', '--unchanged')
327
        bzr('commit', '-m', 'child 5', '--unchanged')
328
        self.check_revno(5)
329
1997.1.5 by Robert Collins
``Branch.bind(other_branch)`` no longer takes a write lock on the
330
        self.check_revno(1, '../base')
1587.1.14 by Robert Collins
Make bound branch creation happen via 'checkout'
331
        bzr('bind', '../base')
1997.1.5 by Robert Collins
``Branch.bind(other_branch)`` no longer takes a write lock on the
332
        self.check_revno(1, '../base')
1505.1.11 by John Arbash Meinel
Adding a little bit more to the test suite.
333
1505.1.24 by John Arbash Meinel
Updated commit to handle bound branches. Included test to handle commit after merge
334
    def test_commit_after_merge(self):
335
        bzr = self.run_bzr
336
        self.create_branches()
337
338
        # We want merge to be able to be a local only
339
        # operation, because it can be without violating
340
        # the binding invariants.
341
        # But we can't fail afterwards
342
343
        bzr('branch', 'child', 'other')
344
345
        os.chdir('other')
346
        open('c', 'wb').write('file c\n')
347
        bzr('add', 'c')
348
        bzr('commit', '-m', 'adding c')
349
        new_rev_id = bzr('revision-history')[0].strip().split('\n')[-1]
350
351
        os.chdir('../child')
352
        bzr('merge', '../other')
353
354
        self.failUnlessExists('c')
1908.6.11 by Robert Collins
Remove usage of tree.pending_merges().
355
        tree = WorkingTree.open('.') # opens child
356
        self.assertEqual([new_rev_id], tree.get_parent_ids()[1:])
1505.1.24 by John Arbash Meinel
Updated commit to handle bound branches. Included test to handle commit after merge
357
358
        # Make sure the local branch has the installed revision
359
        bzr('cat-revision', new_rev_id)
360
        
361
        # And make sure that the base tree does not
362
        os.chdir('../base')
363
        bzr('cat-revision', new_rev_id, retcode=3)
364
365
        # Commit should succeed, and cause merged revisions to
366
        # be pulled into base
367
        os.chdir('../child')
368
        bzr('commit', '-m', 'merge other')
369
370
        self.check_revno(2)
371
372
        os.chdir('../base')
373
        self.check_revno(2)
374
375
        bzr('cat-revision', new_rev_id)
376
2246.1.3 by Robert Collins
New branch hooks: post_push, post_pull, post_commit, post_uncommit. These
377
    def test_pull_overwrite(self):
378
        # XXX: This test should be moved to branch-implemenations/test_pull
1505.1.25 by John Arbash Meinel
Updated pull. Now all paths which call set_revision_history maintain the branch invariant. All tests pass.
379
        bzr = self.run_bzr
380
        self.create_branches()
381
382
        bzr('branch', 'child', 'other')
383
        
384
        os.chdir('other')
385
        open('a', 'wb').write('new contents\n')
386
        bzr('commit', '-m', 'changed a')
387
        self.check_revno(2)
388
        open('a', 'ab').write('and then some\n')
389
        bzr('commit', '-m', 'another a')
390
        self.check_revno(3)
391
        open('a', 'ab').write('and some more\n')
392
        bzr('commit', '-m', 'yet another a')
393
        self.check_revno(4)
394
395
        os.chdir('../child')
396
        open('a', 'wb').write('also changed a\n')
397
        bzr('commit', '-m', 'child modified a')
398
399
        self.check_revno(2)
400
        self.check_revno(2, '../base')
401
2246.1.3 by Robert Collins
New branch hooks: post_push, post_pull, post_commit, post_uncommit. These
402
        bzr('pull', '--overwrite', '../other')
403
404
        # both the local and master should have been updated.
405
        self.check_revno(4)
406
        self.check_revno(4, '../base')