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',
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())
114
def test_sprout_preserves_tags(self):
115
"""Sprout preserves tags, even tags of absent revisions."""
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()
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'))
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')