37
38
target = source.bzrdir.sprout(self.get_url('target')).open_branch()
38
39
self.assertEqual(source.bzrdir.root_transport.base, target.get_parent())
40
def test_sprout_preserves_kind(self):
41
branch1 = self.make_branch('branch1')
42
target_repo = self.make_repository('branch2')
43
target_repo.fetch(branch1.repository)
44
branch2 = branch1.sprout(target_repo.bzrdir)
45
if isinstance(branch1, remote.RemoteBranch):
46
branch1._ensure_real()
47
target_class = branch1._real_branch.__class__
49
target_class = branch1.__class__
50
self.assertIsInstance(branch2, target_class)
41
def test_sprout_uses_bzrdir_branch_format(self):
42
if isinstance(self.branch_format, _mod_branch.BranchReferenceFormat):
43
raise tests.TestNotApplicable('cannot sprout to a reference')
44
# Start with a format that is unlikely to be the target format
45
source = tests.TestCaseWithTransport.make_branch(self, 'old-branch',
47
target_bzrdir = self.make_bzrdir('target')
48
target_bzrdir.create_repository()
49
target = source.sprout(target_bzrdir)
51
self.assertIs(self.branch_format.__class__, target._format.__class__)
52
53
def test_sprout_partial(self):
53
54
# test sprouting with a prefix of the revision-history.