Rev 2251: tag cleanups in http://sourcefrog.net/bzr/tags

Martin Pool mbp at sourcefrog.net
Thu Feb 22 04:52:06 GMT 2007


At http://sourcefrog.net/bzr/tags

------------------------------------------------------------
revno: 2251
revision-id: mbp at sourcefrog.net-20070222045206-zxhd8xxpepbuw8uj
parent: mbp at sourcefrog.net-20070222043908-wt92joyurcxds96p
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: tags
timestamp: Thu 2007-02-22 15:52:06 +1100
message:
  tag cleanups
modified:
  bzrlib/tests/branch_implementations/test_tags.py test_tags.py-20070212110545-w2s799hm2jlbsmg5-1
  bzrlib/tests/test_tag.py       test_tag.py-20070212110532-91cw79inah2cfozx-2
=== modified file 'bzrlib/tests/branch_implementations/test_tags.py'
--- a/bzrlib/tests/branch_implementations/test_tags.py	2007-02-21 04:08:27 +0000
+++ b/bzrlib/tests/branch_implementations/test_tags.py	2007-02-22 04:52:06 +0000
@@ -78,11 +78,13 @@
         else:
             self.fail("didn't get expected exception")
 
-    def test_copy_tags(self):
+    def test_merge_tags(self):
         b1 = self.make_branch('b1')
         b2 = self.make_branch('b2')
+        # if there are tags in the source and not the destination, then they
+        # just go across
         b1.tags.set_tag('tagname', 'revid')
-        b1.copy_tags_to(b2)
+        b1.tags.merge_to(b2.tags)
         self.assertEquals(b2.tags.lookup_tag('tagname'), 'revid')
 
     def test_unicode_tag(self):
@@ -113,6 +115,12 @@
         self.assertRaises(errors.NoSuchTag,
             b.tags.delete_tag, tag_name + '2')
 
+    def test_merge_empty_tags(self):
+        # you can merge tags between two instances, since neither have tags
+        b1 = self.make_branch('b1')
+        b2 = self.make_branch('b2')
+        b1.tags.merge_to(b2.tags)
+
 
 class TestUnsupportedTags(TestCaseWithBranch):
     """Formats that don't support tags should give reasonable errors."""
@@ -140,3 +148,9 @@
             b.tags.set_tag, 'foo', 'bar')
         self.assertRaises(errors.TagsNotSupported,
             b.tags.delete_tag, 'foo')
+
+    def test_merge_empty_tags(self):
+        # you can merge tags between two instances, since neither have tags
+        b1 = self.make_branch('b1')
+        b2 = self.make_branch('b2')
+        b1.tags.merge_to(b2.tags)

=== modified file 'bzrlib/tests/test_tag.py'
--- a/bzrlib/tests/test_tag.py	2007-02-22 04:39:08 +0000
+++ b/bzrlib/tests/test_tag.py	2007-02-22 04:52:06 +0000
@@ -69,14 +69,13 @@
             "%s is expected to support tags but does not" % new_branch)
         # there are no tags in the old one, and we can merge from it into the
         # new one
-        _merge_tags_if_possible(old_branch, new_branch)
+        old_branch.tags.merge_to(new_branch.tags)
         # we couldn't merge tags from the new branch to the old one, but as
         # there are not any yet this isn't a problem
-        _merge_tags_if_possible(new_branch, old_branch)
+        new_branch.tags.merge_to(old_branch.tags)
         # but if there is a tag in the new one, we get a warning when trying
         # to move it back
         new_branch.tags.set_tag(u'\u2040tag', 'revid')
-        _merge_tags_if_possible(old_branch, new_branch)
+        old_branch.tags.merge_to(new_branch.tags)
         self.assertRaises(errors.TagsNotSupported,
-            _merge_tags_if_possible, new_branch, old_branch)
-
+            new_branch.tags.merge_to, old_branch.tags)




More information about the bazaar-commits mailing list