42
42
self.failUnlessExists('child')
46
self.failUnlessExists('.bzr/bound')
44
self.check_revno(1, 'child')
45
self.failUnlessExists('child/.bzr/bound')
49
47
def check_revno(self, val, loc=None):
50
48
if loc is not None:
53
self.assertEquals(self.capture('revno').strip(), str(val))
51
self.assertEquals(str(val), self.run_bzr('revno')[0].strip())
54
52
if loc is not None:
88
86
self.check_revno(2)
90
88
# Make sure it committed on the parent
89
self.check_revno(2, '../base')
94
91
def test_bound_fail(self):
95
92
"""Make sure commit fails if out of date."""
211
205
self.check_revno(3, '../base')
213
207
# After binding, the revision history should be identical
214
child_rh = self.capture('revision-history')
208
child_rh = bzr('revision-history')[0]
215
209
os.chdir('../base')
216
base_rh = self.capture('revision-history')
210
base_rh = bzr('revision-history')[0]
217
211
self.assertEquals(child_rh, base_rh)
219
213
def test_bind_parent_ahead(self):
270
264
self.check_revno(5, '../base')
266
def test_commit_after_merge(self):
268
self.create_branches()
270
# We want merge to be able to be a local only
271
# operation, because it can be without violating
272
# the binding invariants.
273
# But we can't fail afterwards
275
bzr('branch', 'child', 'other')
278
open('c', 'wb').write('file c\n')
280
bzr('commit', '-m', 'adding c')
281
new_rev_id = bzr('revision-history')[0].strip().split('\n')[-1]
284
bzr('merge', '../other')
286
self.failUnlessExists('c')
287
self.assertEqual(new_rev_id,
288
open('.bzr/pending-merges', 'rb').read().strip())
290
# Make sure the local branch has the installed revision
291
bzr('cat-revision', new_rev_id)
293
# And make sure that the base tree does not
295
bzr('cat-revision', new_rev_id, retcode=3)
297
# Commit should succeed, and cause merged revisions to
298
# be pulled into base
300
bzr('commit', '-m', 'merge other')
307
bzr('cat-revision', new_rev_id)