~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Aaron Bentley
  • Author(s): Jonathan Lange
  • Date: 2008-06-06 06:16:07 UTC
  • mto: (3242.3.25 stacking-policy)
  • mto: This revision was merged to the branch mainline in revision 3538.
  • Revision ID: aaron@aaronbentley.com-20080606061607-ffpsfhubfdip7w1y
Preserve stacking in clone

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
        new_tree = new_dir.open_workingtree()
59
59
        new_tree.commit('something local')
60
60
 
 
61
    def test_clone_from_stacked_branch(self):
 
62
        # We can clone from the bzrdir of a stacked branch. The cloned
 
63
        # branch is stacked on the same branch as the original.
 
64
        tree = self.make_branch_and_tree('stacked-on')
 
65
        tree.commit('Added foo')
 
66
        try:
 
67
            stacked_bzrdir = tree.branch.bzrdir.sprout(
 
68
                'stacked', tree.branch.last_revision(), shallow=True)
 
69
        except (errors.UnstackableBranchFormat,
 
70
                errors.UnstackableRepositoryFormat):
 
71
            # not a testable combination.
 
72
            return
 
73
        cloned_bzrdir = stacked_bzrdir.clone('cloned')
 
74
        try:
 
75
            self.assertEqual(
 
76
                stacked_bzrdir.open_branch().get_stacked_on(),
 
77
                cloned_bzrdir.open_branch().get_stacked_on())
 
78
        except (errors.UnstackableBranchFormat,
 
79
                errors.UnstackableRepositoryFormat):
 
80
            pass
 
81