Mercurial > hgsubversion
comparison tests/test_tags.py @ 1570:d55c9d0ba350
tests: use scmutils.revsymbol instead of repo.__getitem__ for non-integers
author | Paul Morelle <paul.morelle@octobus.net> |
---|---|
date | Fri, 25 May 2018 11:52:03 +0200 |
parents | 9a6bb3657861 |
children | e2d38f6b8afe |
comparison
equal
deleted
inserted
replaced
1569:4afe8d7e4602 | 1570:d55c9d0ba350 |
---|---|
11 | 11 |
12 from hgsubversion import compathacks | 12 from hgsubversion import compathacks |
13 from hgsubversion import svncommands | 13 from hgsubversion import svncommands |
14 from hgsubversion import svnrepo | 14 from hgsubversion import svnrepo |
15 | 15 |
16 revsymbol = test_util.revsymbol | |
17 | |
16 class TestTags(test_util.TestBase): | 18 class TestTags(test_util.TestBase): |
17 stupid_mode_tests = True | 19 stupid_mode_tests = True |
18 | 20 |
19 def test_tags(self): | 21 def test_tags(self): |
20 repo = self._load_fixture_and_fetch('basic_tag_tests.svndump') | 22 repo = self._load_fixture_and_fetch('basic_tag_tests.svndump') |
21 self.assertEqual(sorted(repo.tags()), ['copied_tag', 'tag_r3', 'tip']) | 23 self.assertEqual(sorted(repo.tags()), ['copied_tag', 'tag_r3', 'tip']) |
22 self.assertEqual(repo['tag_r3'], repo['copied_tag']) | 24 self.assertEqual(revsymbol(repo, 'tag_r3'), revsymbol(repo, 'copied_tag')) |
23 self.assertEqual(repo['tag_r3'].rev(), 1) | 25 self.assertEqual(revsymbol(repo,'tag_r3').rev(), 1) |
24 | 26 |
25 def test_remove_tag(self): | 27 def test_remove_tag(self): |
26 repo = self._load_fixture_and_fetch('remove_tag_test.svndump') | 28 repo = self._load_fixture_and_fetch('remove_tag_test.svndump') |
27 self.assertEqual(repo['tag_r3'].rev(), 1) | 29 self.assertEqual(revsymbol(repo, 'tag_r3').rev(), 1) |
28 self.assert_('copied_tag' not in repo.tags()) | 30 self.assert_('copied_tag' not in repo.tags()) |
29 | 31 |
30 def test_rename_tag(self): | 32 def test_rename_tag(self): |
31 expected = """\ | 33 expected = """\ |
32 node: hg=default@2:svn=trunk@4 | 34 node: hg=default@2:svn=trunk@4 |
48 self._test_tags('rename_tag_test.svndump', expected) | 50 self._test_tags('rename_tag_test.svndump', expected) |
49 | 51 |
50 def test_branch_from_tag(self): | 52 def test_branch_from_tag(self): |
51 repo = self._load_fixture_and_fetch('branch_from_tag.svndump') | 53 repo = self._load_fixture_and_fetch('branch_from_tag.svndump') |
52 self.assert_('branch_from_tag' in compathacks.branchset(repo)) | 54 self.assert_('branch_from_tag' in compathacks.branchset(repo)) |
53 self.assertEqual(repo[1], repo['tag_r3']) | 55 self.assertEqual(repo[1], revsymbol(repo, 'tag_r3')) |
54 self.assertEqual(repo['branch_from_tag'].parents()[0], repo['copied_tag']) | 56 self.assertEqual(revsymbol(repo, 'branch_from_tag').parents()[0], |
57 revsymbol(repo, 'copied_tag')) | |
55 | 58 |
56 def test_tag_by_renaming_branch(self): | 59 def test_tag_by_renaming_branch(self): |
57 repo = self._load_fixture_and_fetch('tag_by_rename_branch.svndump') | 60 repo = self._load_fixture_and_fetch('tag_by_rename_branch.svndump') |
58 branches = set(repo[h] for h in repo.heads()) | 61 branches = set(repo[h] for h in repo.heads()) |
59 self.assert_('dummy' not in branches) | 62 self.assert_('dummy' not in branches) |
60 self.assertEqual(repo['dummy'], repo['tip'].parents()[0], | 63 self.assertEqual(revsymbol(repo, 'dummy'), |
61 '%r != %r[0]' % (repo['dummy'], | 64 revsymbol(repo, 'tip').parents()[0], |
65 '%r != %r[0]' % (revsymbol(repo, 'dummy'), | |
62 repo['tip'].parents())) | 66 repo['tip'].parents())) |
63 extra = repo['tip'].extra().copy() | 67 extra = repo['tip'].extra().copy() |
64 extra.pop('convert_revision', None) | 68 extra.pop('convert_revision', None) |
65 self.assertEqual(extra, {'branch': 'dummy', 'close': '1'}) | 69 self.assertEqual(extra, {'branch': 'dummy', 'close': '1'}) |
66 | 70 |
127 repo[willedit].extra(), | 131 repo[willedit].extra(), |
128 {'close': '1', | 132 {'close': '1', |
129 'branch': 'magic', | 133 'branch': 'magic', |
130 'convert_revision': 'svn:af82cc90-c2d2-43cd-b1aa-c8a78449440a/tags/will-edit@19'}) | 134 'convert_revision': 'svn:af82cc90-c2d2-43cd-b1aa-c8a78449440a/tags/will-edit@19'}) |
131 self.assertEqual(willedit, repo.tags()['will-edit']) | 135 self.assertEqual(willedit, repo.tags()['will-edit']) |
132 self.assertEqual(sorted(repo['will-edit'].manifest().keys()), | 136 self.assertEqual(sorted(revsymbol(repo, 'will-edit').manifest().keys()), |
133 ['alpha', 'beta', 'gamma']) | 137 ['alpha', 'beta', 'gamma']) |
134 self.assertEqual( | 138 self.assertEqual( |
135 repo[alsoedit].extra(), | 139 repo[alsoedit].extra(), |
136 {'close': '1', | 140 {'close': '1', |
137 'branch': 'magic', | 141 'branch': 'magic', |
138 'convert_revision': 'svn:af82cc90-c2d2-43cd-b1aa-c8a78449440a/tags/also-edit@14'}) | 142 'convert_revision': 'svn:af82cc90-c2d2-43cd-b1aa-c8a78449440a/tags/also-edit@14'}) |
139 self.assertEqual(repo[alsoedit].parents()[0].node(), repo.tags()['also-edit']) | 143 self.assertEqual(repo[alsoedit].parents()[0].node(), repo.tags()['also-edit']) |
140 self.assertEqual(sorted(repo['also-edit'].manifest().keys()), | 144 self.assertEqual(sorted(revsymbol(repo, 'also-edit').manifest().keys()), |
141 ['.hgtags', 'alpha', 'beta', 'delta', 'gamma', 'iota', | 145 ['.hgtags', 'alpha', 'beta', 'delta', 'gamma', 'iota', |
142 'lambda', 'omega']) | 146 'lambda', 'omega']) |
143 | 147 |
144 self.assertEqual(editlater, repo['edit-later'].node()) | 148 self.assertEqual(editlater, revsymbol(repo, 'edit-later').node()) |
145 self.assertEqual( | 149 self.assertEqual( |
146 repo[closeme].extra(), | 150 repo[closeme].extra(), |
147 {'close': '1', | 151 {'close': '1', |
148 'branch': 'closeme', | 152 'branch': 'closeme', |
149 'convert_revision': 'svn:af82cc90-c2d2-43cd-b1aa-c8a78449440a/branches/closeme@17'}) | 153 'convert_revision': 'svn:af82cc90-c2d2-43cd-b1aa-c8a78449440a/branches/closeme@17'}) |
150 self.assertEqual('alpha\nalpha\n', repo['edit-at-create']['alpha'].data()) | 154 self.assertEqual('alpha\nalpha\n', revsymbol(repo, 'edit-at-create')['alpha'].data()) |
151 | 155 |
152 def test_tags_in_unusual_location(self): | 156 def test_tags_in_unusual_location(self): |
153 repo = self._load_fixture_and_fetch('tag_name_same_as_branch.svndump') | 157 repo = self._load_fixture_and_fetch('tag_name_same_as_branch.svndump') |
154 self.assertEqual(len(repo.heads()), 1) | 158 self.assertEqual(len(repo.heads()), 1) |
155 branches = set(repo[h].extra()['branch'] | 159 branches = set(repo[h].extra()['branch'] |