70
69
class TestTagMerging(TestCaseWithTransport):
72
71
def make_knit_branch(self, relpath):
73
old_bdf = bzrdir.format_registry.make_bzrdir('knit')
74
return bzrdir.BzrDir.create_branch_convenience(relpath, format=old_bdf)
72
old_bdf = controldir.format_registry.make_bzrdir('knit')
73
return controldir.ControlDir.create_branch_convenience(relpath, format=old_bdf)
76
75
def make_branch_supporting_tags(self, relpath):
77
76
return self.make_branch(relpath, format='dirstate-tags')
110
109
self.assertRaises(errors.NoSuchTag, a.tags.lookup_tag, 'tag-2')
111
110
# conflicting merge
112
111
a.tags.set_tag('tag-2', 'z')
113
conflicts = a.tags.merge_to(b.tags)
114
self.assertEqual(conflicts, [('tag-2', 'z', 'y')])
112
updates, conflicts = a.tags.merge_to(b.tags)
113
self.assertEqual({}, updates)
114
self.assertEqual(list(conflicts), [('tag-2', 'z', 'y')])
115
115
self.assertEqual('y', b.tags.lookup_tag('tag-2'))
116
116
# overwrite conflicts
117
conflicts = a.tags.merge_to(b.tags, overwrite=True)
118
self.assertEqual(conflicts, [])
117
updates, conflicts = a.tags.merge_to(b.tags, overwrite=True)
118
self.assertEqual(list(conflicts), [])
119
self.assertEqual({u'tag-2': 'z'}, updates)
119
120
self.assertEqual('z', b.tags.lookup_tag('tag-2'))
122
123
class TestTagsInCheckouts(TestCaseWithTransport):
124
"""Tests for how tags are synchronised between the master and child branch
124
128
def test_update_tag_into_checkout(self):
125
129
# checkouts are directly connected to the tags of their master branch:
166
170
# and deletion of tags should also propagate
167
171
master.tags.delete_tag('foo')
168
raise KnownFailure("tag deletion does not propagate: "
172
self.knownFailure("tag deletion does not propagate: "
169
173
"https://bugs.launchpad.net/bzr/+bug/138802")
170
174
self.assertRaises(errors.NoSuchTag,
171
175
child.tags.lookup_tag, 'foo')