Mercurial > hgsubversion
comparison tests/test_tags.py @ 457:8ad6dfd51f72
Merge with mpedersen.
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Sun, 05 Jul 2009 21:13:13 -0500 |
parents | bb612e625be6 |
children | 63cb630d667d |
comparison
equal
deleted
inserted
replaced
456:b5b4095d2993 | 457:8ad6dfd51f72 |
---|---|
1 import os | |
1 import unittest | 2 import unittest |
2 | 3 |
4 from mercurial import commands | |
3 from mercurial import hg | 5 from mercurial import hg |
4 from mercurial import node | 6 from mercurial import node |
5 from mercurial import ui | 7 from mercurial import ui |
6 | 8 |
7 import test_util | 9 import test_util |
90 self.test_edited_tag(True) | 92 self.test_edited_tag(True) |
91 | 93 |
92 def test_edited_tag(self, stupid=False): | 94 def test_edited_tag(self, stupid=False): |
93 repo = self._load_fixture_and_fetch('commit-to-tag.svndump', | 95 repo = self._load_fixture_and_fetch('commit-to-tag.svndump', |
94 stupid=stupid) | 96 stupid=stupid) |
95 self.assertEqual(len(repo.heads()), 4) | 97 self.assertEqual(len(repo.heads()), 5) |
96 heads = repo.heads() | 98 heads = repo.heads() |
97 openheads = [h for h in heads if not repo[h].extra().get('close', False)] | 99 openheads = [h for h in heads if not repo[h].extra().get('close', False)] |
98 closedheads = set(heads) - set(openheads) | 100 closedheads = set(heads) - set(openheads) |
99 self.assertEqual(len(openheads), 0) | 101 self.assertEqual(len(openheads), 1) |
100 self.assertEqual(len(closedheads), 4) | 102 self.assertEqual(len(closedheads), 4) |
101 closedheads = sorted(list(closedheads), cmp=lambda x,y: cmp(repo[x].rev(), | 103 closedheads = sorted(list(closedheads), |
102 repo[y].rev())) | 104 cmp=lambda x,y: cmp(repo[x].rev(), repo[y].rev())) |
105 | |
103 # closeme has no open heads | 106 # closeme has no open heads |
104 for h in openheads: | 107 for h in openheads: |
105 self.assertNotEqual('closeme', repo[openheads[0]].branch()) | 108 self.assertNotEqual('closeme', repo[openheads[0]].branch()) |
106 | 109 |
107 self.assertEqual(1, len(self.repo.branchheads('magic'))) | 110 self.assertEqual(1, len(self.repo.branchheads('magic'))) |
108 | 111 |
109 willedit, alsoedit, editlater, closeme = closedheads | 112 alsoedit, editlater, closeme, willedit, = closedheads |
110 self.assertEqual( | 113 self.assertEqual( |
111 repo[willedit].extra(), | 114 repo[willedit].extra(), |
112 {'close': '1', | 115 {'close': '1', |
113 'branch': 'magic', | 116 'branch': 'magic', |
114 'convert_revision': 'svn:af82cc90-c2d2-43cd-b1aa-c8a78449440a/tags/will-edit@9'}) | 117 'convert_revision': 'svn:af82cc90-c2d2-43cd-b1aa-c8a78449440a/tags/will-edit@19'}) |
115 self.assertEqual(willedit, repo.tags()['will-edit']) | 118 self.assertEqual(willedit, repo.tags()['will-edit']) |
116 self.assertEqual(repo['will-edit'].manifest().keys(), ['beta', | 119 self.assertEqual(repo['will-edit'].manifest().keys(), ['alpha', |
120 'beta', | |
117 'gamma', | 121 'gamma', |
118 ]) | 122 ]) |
119 self.assertEqual( | 123 self.assertEqual( |
120 repo[alsoedit].extra(), | 124 repo[alsoedit].extra(), |
121 {'close': '1', | 125 {'close': '1', |
152 tags, | 156 tags, |
153 {'magic': '\xa2b\xb9\x03\xc6\xbd\x903\x95\xf5\x0f\x94\xcey\xc4E\xfaE6\xaa', | 157 {'magic': '\xa2b\xb9\x03\xc6\xbd\x903\x95\xf5\x0f\x94\xcey\xc4E\xfaE6\xaa', |
154 'magic2': '\xa3\xa2D\x86aM\xc0v\xb9\xb0\x18\x14\xad\xacwBUi}\xe2', | 158 'magic2': '\xa3\xa2D\x86aM\xc0v\xb9\xb0\x18\x14\xad\xacwBUi}\xe2', |
155 }) | 159 }) |
156 | 160 |
161 def test_old_tag_map_rebuilds(self): | |
162 repo = self._load_fixture_and_fetch('tag_name_same_as_branch.svndump') | |
163 tm = os.path.join(repo.path, 'svn', 'tagmap') | |
164 open(tm, 'w').write('1\n') | |
165 commands.pull(repo.ui, repo) | |
166 self.assertEqual(open(tm).read().splitlines()[0], '2') | |
167 | |
168 | |
157 def suite(): | 169 def suite(): |
158 return unittest.TestLoader().loadTestsFromTestCase(TestTags) | 170 return unittest.TestLoader().loadTestsFromTestCase(TestTags) |