~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
        # Start with a format that is unlikely to be the target format
54
54
        # We call the super class to allow overriding the format of creation)
55
55
        source = tests.TestCaseWithTransport.make_branch(self, 'old-branch',
56
 
                                                         format='metaweave')
 
56
                                                         format='knit')
57
57
        target_bzrdir = self.make_bzrdir('target')
58
58
        target_bzrdir.create_repository()
59
59
        result_format = self.branch_format
111
111
        self.assertEqual((2, 'rev2-alt'), branch2.last_revision_info())
112
112
        self.assertEqual(['rev1', 'rev2-alt'], branch2.revision_history())
113
113
 
 
114
    def test_sprout_preserves_tags(self):
 
115
        """Sprout preserves tags, even tags of absent revisions."""
 
116
        try:
 
117
            builder = self.make_branch_builder('source')
 
118
        except errors.UninitializableFormat:
 
119
            raise tests.TestSkipped('Uninitializable branch format')
 
120
        builder.build_commit(message="Rev 1", rev_id='rev-1')
 
121
        source = builder.get_branch()
 
122
        try:
 
123
            source.tags.set_tag('tag-a', 'missing-rev')
 
124
        except errors.TagsNotSupported:
 
125
            raise tests.TestNotApplicable(
 
126
                'Branch format does not support tags.')
 
127
        # Now source has a tag pointing to an absent revision.  Sprout it.
 
128
        target_bzrdir = self.make_repository('target').bzrdir
 
129
        new_branch = source.sprout(target_bzrdir)
 
130
        # The tag is present in the target
 
131
        self.assertEqual('missing-rev', new_branch.tags.lookup_tag('tag-a'))
 
132
 
114
133
    def test_sprout_from_any_repo_revision(self):
115
134
        """We should be able to sprout from any revision."""
116
135
        wt = self.make_branch_and_tree('source')
182
201
                source.last_revision(), possible_transports=[target_transport],
183
202
                source_branch=source, stacked=True)
184
203
        except errors.UnstackableBranchFormat:
185
 
            if isinstance(self.branch_format, _mod_branch.BzrBranchFormat4):
186
 
                raise tests.KnownFailure(
187
 
                    "Format 4 doesn't auto stack successfully.")
 
204
            if not self.branch_format.supports_stacking():
 
205
                raise tests.TestNotApplicable(
 
206
                    "Format doesn't auto stack successfully.")
188
207
            else:
189
208
                raise
190
209
        result = dir.open_branch()