comparison 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
comparison
equal deleted inserted replaced
448:fbc7cf4fd701 449:bda5b47ad2a2
90 self.test_edited_tag(True) 90 self.test_edited_tag(True)
91 91
92 def test_edited_tag(self, stupid=False): 92 def test_edited_tag(self, stupid=False):
93 repo = self._load_fixture_and_fetch('commit-to-tag.svndump', 93 repo = self._load_fixture_and_fetch('commit-to-tag.svndump',
94 stupid=stupid) 94 stupid=stupid)
95 self.assertEqual(len(repo.heads()), 2) 95 self.assertEqual(len(repo.heads()), 3)
96 heads = repo.heads() 96 heads = repo.heads()
97 openheads = [h for h in heads if not repo[h].extra().get('close', False)] 97 openheads = [h for h in heads if not repo[h].extra().get('close', False)]
98 closedheads = set(heads) - set(openheads) 98 closedheads = set(heads) - set(openheads)
99 self.assertEqual(len(openheads), 1) 99 self.assertEqual(len(openheads), 1)
100 self.assertEqual(len(closedheads), 1) 100 self.assertEqual(len(closedheads), 2)
101 tagged = list(closedheads)[0] 101 closedheads = sorted(list(closedheads), cmp=lambda x,y: cmp(repo[x].rev(),
102 repo[y].rev()))
103 willedit, alsoedit = closedheads
102 self.assertEqual( 104 self.assertEqual(
103 repo[tagged].extra(), 105 repo[willedit].extra(),
104 {'close': '1', 106 {'close': '1',
105 'branch': 'magic', 107 'branch': 'magic',
106 'convert_revision': 'svn:af82cc90-c2d2-43cd-b1aa-c8a78449440a/tags/will-edit@9'}) 108 'convert_revision': 'svn:af82cc90-c2d2-43cd-b1aa-c8a78449440a/tags/will-edit@9'})
107 self.assertEqual(tagged, repo.tags()['will-edit']) 109 self.assertEqual(willedit, repo.tags()['will-edit'])
108 self.assertEqual(repo['will-edit'].manifest().keys(), ['beta', 110 self.assertEqual(repo['will-edit'].manifest().keys(), ['beta',
109 'gamma', 111 'gamma',
110 ]) 112 ])
113 self.assertEqual(
114 repo[alsoedit].extra(),
115 {'close': '1',
116 'branch': 'magic',
117 'convert_revision': 'svn:af82cc90-c2d2-43cd-b1aa-c8a78449440a/tags/also-edit@12'})
118 self.assertEqual(alsoedit, repo.tags()['also-edit'])
119 self.assertEqual(repo['also-edit'].manifest().keys(),
120 ['beta',
121 '.hgtags',
122 'delta',
123 'alpha',
124 'omega',
125 'iota',
126 'gamma',
127 'lambda',
128 ])
111 129
112 def test_tags_in_unusual_location(self): 130 def test_tags_in_unusual_location(self):
113 repo = self._load_fixture_and_fetch('tag_name_same_as_branch.svndump') 131 repo = self._load_fixture_and_fetch('tag_name_same_as_branch.svndump')
114 self.assertEqual(len(repo.heads()), 1) 132 self.assertEqual(len(repo.heads()), 1)
115 branches = set(repo[h].extra()['branch'] 133 branches = set(repo[h].extra()['branch']