~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Vincent Ladeuil
  • Date: 2011-11-24 15:48:29 UTC
  • mfrom: (6289 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6337.
  • Revision ID: v.ladeuil+lp@free.fr-20111124154829-avowjpsxdl8yp2vz
merge trunk resolving conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
    revision as _mod_revision,
26
26
    tests,
27
27
    )
 
28
from bzrlib.tests import (
 
29
    features,
 
30
    )
28
31
from bzrlib.tests.per_branch import TestCaseWithBranch
29
32
 
30
33
 
109
112
        repo.fetch(wt.branch.repository)
110
113
        branch2 = wt.branch.sprout(repo.bzrdir, revision_id='rev2-alt')
111
114
        self.assertEqual((2, 'rev2-alt'), branch2.last_revision_info())
112
 
        self.assertEqual(['rev1', 'rev2-alt'], branch2.revision_history())
 
115
        self.assertEqual('rev2-alt', branch2.last_revision())
113
116
 
114
117
    def test_sprout_preserves_tags(self):
115
118
        """Sprout preserves tags, even tags of absent revisions."""
121
124
        source = builder.get_branch()
122
125
        try:
123
126
            source.tags.set_tag('tag-a', 'missing-rev')
124
 
        except errors.TagsNotSupported:
 
127
        except (errors.TagsNotSupported, errors.GhostTagsNotSupported):
125
128
            raise tests.TestNotApplicable(
126
 
                'Branch format does not support tags.')
 
129
                'Branch format does not support tags or tags to ghosts.')
127
130
        # Now source has a tag pointing to an absent revision.  Sprout it.
128
131
        target_bzrdir = self.make_repository('target').bzrdir
129
132
        new_branch = source.sprout(target_bzrdir)
151
154
        # Since the trigger function seems to be set_parent_trees, there exists
152
155
        # also a similar test, with name test_unicode_symlink, in class
153
156
        # TestSetParents at file per_workingtree/test_parents.py
154
 
        self.requireFeature(tests.SymlinkFeature)
155
 
        self.requireFeature(tests.UnicodeFilenameFeature)
 
157
        self.requireFeature(features.SymlinkFeature)
 
158
        self.requireFeature(features.UnicodeFilenameFeature)
156
159
 
157
160
        tree = self.make_branch_and_tree('tree1')
158
161
 
176
179
 
177
180
    def test_sprout_with_ghost_in_mainline(self):
178
181
        tree = self.make_branch_and_tree('tree1')
 
182
        if not tree.branch.repository._format.supports_ghosts:
 
183
            raise tests.TestNotApplicable(
 
184
                "repository format does not support ghosts in mainline")
179
185
        tree.set_parent_ids(["spooky"], allow_leftmost_as_ghost=True)
180
186
        tree.add('')
181
187
        tree.commit('msg1', rev_id='rev1')