~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/branch_implementations/test_sprout.py

  • Committer: Mark Hammond
  • Date: 2008-12-28 05:21:23 UTC
  • mfrom: (3920 +trunk)
  • mto: (3932.1.1 prepare-1.11)
  • mto: This revision was merged to the branch mainline in revision 3937.
  • Revision ID: mhammond@skippinet.com.au-20081228052123-f78xs5sbdkotshwf
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
import os
20
20
from bzrlib import (
 
21
    branch as _mod_branch,
21
22
    remote,
22
23
    revision as _mod_revision,
23
24
    tests,
37
38
        target = source.bzrdir.sprout(self.get_url('target')).open_branch()
38
39
        self.assertEqual(source.bzrdir.root_transport.base, target.get_parent())
39
40
 
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__
48
 
        else:
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',
 
46
                                                         format='metaweave')
 
47
        target_bzrdir = self.make_bzrdir('target')
 
48
        target_bzrdir.create_repository()
 
49
        target = source.sprout(target_bzrdir)
 
50
 
 
51
        self.assertIs(self.branch_format.__class__, target._format.__class__)
51
52
 
52
53
    def test_sprout_partial(self):
53
54
        # test sprouting with a prefix of the revision-history.