~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-07-06 09:22:00 UTC
  • mfrom: (6008 +trunk)
  • mto: (6012.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 6013.
  • Revision ID: v.ladeuil+lp@free.fr-20110706092200-7iai2mwzc0sqdsvf
MergingĀ inĀ 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')