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