comparison tests/test_tags.py @ 452:ae35c389cdef

tags: allow editing tags of closed branches without reopening the branch
author Augie Fackler <durin42@gmail.com>
date Fri, 26 Jun 2009 14:53:58 -0500
parents e533e78f1b2f
children bb612e625be6
comparison
equal deleted inserted replaced
451:e533e78f1b2f 452:ae35c389cdef
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()), 3) 95 self.assertEqual(len(repo.heads()), 4)
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), 0)
100 self.assertEqual(len(closedheads), 2) 100 self.assertEqual(len(closedheads), 4)
101 closedheads = sorted(list(closedheads), cmp=lambda x,y: cmp(repo[x].rev(), 101 closedheads = sorted(list(closedheads), cmp=lambda x,y: cmp(repo[x].rev(),
102 repo[y].rev())) 102 repo[y].rev()))
103 willedit, alsoedit = closedheads 103 # closeme has no open heads
104 for h in openheads:
105 self.assertNotEqual('closeme', repo[openheads[0]].branch())
106
107 self.assertEqual(1, len(self.repo.branchheads('magic')))
108
109 willedit, alsoedit, editlater, closeme = closedheads
104 self.assertEqual( 110 self.assertEqual(
105 repo[willedit].extra(), 111 repo[willedit].extra(),
106 {'close': '1', 112 {'close': '1',
107 'branch': 'magic', 113 'branch': 'magic',
108 'convert_revision': 'svn:af82cc90-c2d2-43cd-b1aa-c8a78449440a/tags/will-edit@9'}) 114 'convert_revision': 'svn:af82cc90-c2d2-43cd-b1aa-c8a78449440a/tags/will-edit@9'})
125 'iota', 131 'iota',
126 'gamma', 132 'gamma',
127 'lambda', 133 'lambda',
128 ]) 134 ])
129 135
136 self.assertEqual(editlater, repo['edit-later'].node())
137 self.assertEqual(
138 repo[closeme].extra(),
139 {'close': '1',
140 'branch': 'closeme',
141 'convert_revision': 'svn:af82cc90-c2d2-43cd-b1aa-c8a78449440a/branches/closeme@17'})
142
130 def test_tags_in_unusual_location(self): 143 def test_tags_in_unusual_location(self):
131 repo = self._load_fixture_and_fetch('tag_name_same_as_branch.svndump') 144 repo = self._load_fixture_and_fetch('tag_name_same_as_branch.svndump')
132 self.assertEqual(len(repo.heads()), 1) 145 self.assertEqual(len(repo.heads()), 1)
133 branches = set(repo[h].extra()['branch'] 146 branches = set(repo[h].extra()['branch']
134 for h in repo.heads()) 147 for h in repo.heads())