21
21
from cStringIO import StringIO
23
26
from bzrlib.branch import Branch
24
27
from bzrlib.bzrdir import (BzrDir, BzrDirFormat, BzrDirMetaFormat1)
25
28
from bzrlib.osutils import getcwd
100
103
self.run_bzr('unbind', retcode=3)
105
def test_bind_branch6(self):
106
branch1 = self.make_branch('branch1', format='dirstate-tags')
108
error = self.run_bzr('bind', retcode=3)[1]
109
self.assertContainsRe(error, 'no previous location known')
111
def setup_rebind(self, format):
112
branch1 = self.make_branch('branch1')
113
branch2 = self.make_branch('branch2', format=format)
114
branch2.bind(branch1)
117
def test_rebind_branch6(self):
118
self.setup_rebind('dirstate-tags')
122
self.assertContainsRe(b.get_bound_location(), '\/branch1\/$')
124
def test_rebind_branch5(self):
125
self.setup_rebind('knit')
127
error = self.run_bzr('bind', retcode=3)[1]
128
self.assertContainsRe(error, 'old locations')
102
130
def init_meta_branch(self, path):
103
old_format = BzrDirFormat.get_default_format()
104
BzrDirFormat.set_default_format(BzrDirMetaFormat1())
106
return BzrDir.create_branch_convenience(
107
path, BzrDirMetaFormat1())
109
BzrDirFormat.set_default_format(old_format)
131
format = bzrdir.format_registry.make_bzrdir('default')
132
return BzrDir.create_branch_convenience(path, format=format)
111
134
def test_bound_commit(self):
112
135
bzr = self.run_bzr
352
375
bzr('cat-revision', new_rev_id)
354
def test_pull_overwrite_fails(self):
377
def test_pull_overwrite(self):
378
# XXX: This test should be moved to branch-implemenations/test_pull
355
379
bzr = self.run_bzr
356
380
self.create_branches()
375
399
self.check_revno(2)
376
400
self.check_revno(2, '../base')
378
# It might be possible that we want pull --overwrite to
380
# If we want it, just change this test to make sure that
381
# both base and child are updated properly
382
bzr('pull', '--overwrite', '../other', retcode=3)
384
# It should fail without changing the local revision
386
self.check_revno(2, '../base')
388
# TODO: jam 20051230 Test that commit & pull fail when the branch we
389
# are bound to is not available
402
bzr('pull', '--overwrite', '../other')
404
# both the local and master should have been updated.
406
self.check_revno(4, '../base')