diff tests/test_tags.py @ 449:bda5b47ad2a2

tags: handle editing a tag and its source branch simultaneously
author Augie Fackler <durin42@gmail.com>
date Tue, 23 Jun 2009 22:15:20 -0500
parents 0d3b5acb1d51
children 7ca49177991a
line wrap: on
line diff
--- a/tests/test_tags.py
+++ b/tests/test_tags.py
@@ -92,22 +92,40 @@ class TestTags(test_util.TestBase):
     def test_edited_tag(self, stupid=False):
        repo = self._load_fixture_and_fetch('commit-to-tag.svndump',
                                            stupid=stupid)
-       self.assertEqual(len(repo.heads()), 2)
+       self.assertEqual(len(repo.heads()), 3)
        heads = repo.heads()
        openheads = [h for h in heads if not repo[h].extra().get('close', False)]
        closedheads = set(heads) - set(openheads)
        self.assertEqual(len(openheads), 1)
-       self.assertEqual(len(closedheads), 1)
-       tagged = list(closedheads)[0]
+       self.assertEqual(len(closedheads), 2)
+       closedheads = sorted(list(closedheads), cmp=lambda x,y: cmp(repo[x].rev(),
+                                                                   repo[y].rev()))
+       willedit, alsoedit = closedheads
        self.assertEqual(
-           repo[tagged].extra(),
+           repo[willedit].extra(),
            {'close': '1',
             'branch': 'magic',
             'convert_revision': 'svn:af82cc90-c2d2-43cd-b1aa-c8a78449440a/tags/will-edit@9'})
-       self.assertEqual(tagged, repo.tags()['will-edit'])
+       self.assertEqual(willedit, repo.tags()['will-edit'])
        self.assertEqual(repo['will-edit'].manifest().keys(), ['beta',
                                                               'gamma',
                                                               ])
+       self.assertEqual(
+           repo[alsoedit].extra(),
+           {'close': '1',
+            'branch': 'magic',
+            'convert_revision': 'svn:af82cc90-c2d2-43cd-b1aa-c8a78449440a/tags/also-edit@12'})
+       self.assertEqual(alsoedit, repo.tags()['also-edit'])
+       self.assertEqual(repo['also-edit'].manifest().keys(),
+                        ['beta',
+                         '.hgtags',
+                         'delta',
+                         'alpha',
+                         'omega',
+                         'iota',
+                         'gamma',
+                         'lambda',
+                         ])
 
     def test_tags_in_unusual_location(self):
         repo = self._load_fixture_and_fetch('tag_name_same_as_branch.svndump')