Mercurial > hgsubversion
comparison tests/test_fetch_command.py @ 1588:e2d38f6b8afe
tests: make output comaptible with hash changes in hg-4.8
46da52f4b820 in core mercurial added logic to try hard to reuse manifest if we
can. In the tests of hgsubversion, there are lot of cases we create an empty
commit with just branch name changed. In hg < 4.8, hgsubversion used to create a
new manifest entry for that commit but after that patch, empty commit started
using the manifest of the parent leading to hash change.
author | Pulkit Goyal <pulkit@yandex-team.ru> |
---|---|
date | Wed, 31 Oct 2018 17:04:57 +0300 |
parents | 68965b2e3401 |
children |
comparison
equal
deleted
inserted
replaced
1587:4889843a704e | 1588:e2d38f6b8afe |
---|---|
39 | 39 |
40 def test_branches(self): | 40 def test_branches(self): |
41 repo = self._load_fixture_and_fetch('simple_branch.svndump') | 41 repo = self._load_fixture_and_fetch('simple_branch.svndump') |
42 self.assertEqual(node.hex(repo[0].node()), | 42 self.assertEqual(node.hex(repo[0].node()), |
43 'a1ff9f5d90852ce7f8e607fa144066b0a06bdc57') | 43 'a1ff9f5d90852ce7f8e607fa144066b0a06bdc57') |
44 self.assertEqual(node.hex(revsymbol(repo, 'tip').node()), | 44 self.assertTrue(node.hex(revsymbol(repo, 'tip').node()) in |
45 '545e36ed13615e39c5c8fb0c325109d8cb8e00c3') | 45 ('545e36ed13615e39c5c8fb0c325109d8cb8e00c3', |
46 '04043a3f29a7070b1ea56d6ef832591956a41381')) | |
46 self.assertEqual(len(revsymbol(repo, 'tip').parents()), 1) | 47 self.assertEqual(len(revsymbol(repo, 'tip').parents()), 1) |
47 self.assertEqual(revsymbol(repo, 'tip').parents()[0], revsymbol(repo, 'default')) | 48 self.assertEqual(revsymbol(repo, 'tip').parents()[0], revsymbol(repo, 'default')) |
48 self.assertEqual(revsymbol(repo, 'tip').extra()['convert_revision'], | 49 self.assertEqual(revsymbol(repo, 'tip').extra()['convert_revision'], |
49 'svn:3cd547df-371e-4add-bccf-aba732a2baf5/branches/the_branch@4') | 50 'svn:3cd547df-371e-4add-bccf-aba732a2baf5/branches/the_branch@4') |
50 self.assertEqual(revsymbol(repo, 'default').extra()['convert_revision'], | 51 self.assertEqual(revsymbol(repo, 'default').extra()['convert_revision'], |
55 repo = self._load_fixture_and_fetch('two_heads.svndump') | 56 repo = self._load_fixture_and_fetch('two_heads.svndump') |
56 self.assertEqual(node.hex(repo[0].node()), | 57 self.assertEqual(node.hex(repo[0].node()), |
57 '434ed487136c1b47c1e8f952edb4dc5a8e6328df') | 58 '434ed487136c1b47c1e8f952edb4dc5a8e6328df') |
58 self.assertEqual(node.hex(revsymbol(repo, 'tip').node()), | 59 self.assertEqual(node.hex(revsymbol(repo, 'tip').node()), |
59 '1083037b18d85cd84fa211c5adbaeff0fea2cd9f') | 60 '1083037b18d85cd84fa211c5adbaeff0fea2cd9f') |
60 self.assertEqual(node.hex(revsymbol(repo, 'the_branch').node()), | 61 # two hashes to be compat with hg < 4.8 because from 4.8 we try hard to |
61 '4e256962fc5df545e2e0a51d0d1dc61c469127e6') | 62 # reuse the manifest |
62 self.assertEqual(node.hex(revsymbol(repo, 'the_branch').parents()[0].node()), | 63 self.assertTrue(node.hex(revsymbol(repo, 'the_branch').node()) in |
63 'f1ff5b860f5dbb9a59ad0921a79da77f10f25109') | 64 ('4e256962fc5df545e2e0a51d0d1dc61c469127e6', |
65 '13c5dc1514ad8619c589a8929bfe0ece5c00f18e')) | |
66 self.assertTrue(node.hex(revsymbol(repo, 'the_branch').parents()[0].node()) in | |
67 ('f1ff5b860f5dbb9a59ad0921a79da77f10f25109', | |
68 '62f4e5fb583a405df3dae62c156461a0f44219f2')) | |
64 self.assertEqual(len(revsymbol(repo, 'tip').parents()), 1) | 69 self.assertEqual(len(revsymbol(repo, 'tip').parents()), 1) |
65 self.assertEqual(revsymbol(repo, 'tip'), revsymbol(repo, 'default')) | 70 self.assertEqual(revsymbol(repo, 'tip'), revsymbol(repo, 'default')) |
66 self.assertEqual(len(repo.heads()), 2) | 71 self.assertEqual(len(repo.heads()), 2) |
67 | 72 |
68 def test_many_special_cases(self): | 73 def test_many_special_cases(self): |
71 self.assertEquals(node.hex(repo[0].node()), | 76 self.assertEquals(node.hex(repo[0].node()), |
72 '434ed487136c1b47c1e8f952edb4dc5a8e6328df') | 77 '434ed487136c1b47c1e8f952edb4dc5a8e6328df') |
73 # two possible hashes for bw compat to hg < 1.5, since hg 1.5 | 78 # two possible hashes for bw compat to hg < 1.5, since hg 1.5 |
74 # sorts entries in extra() | 79 # sorts entries in extra() |
75 self.assertTrue(node.hex(revsymbol(repo, 'tip').node()) in | 80 self.assertTrue(node.hex(revsymbol(repo, 'tip').node()) in |
76 ('e92012d8c170a0236c84166167f149c2e28548c6', | 81 ('e92012d8c170a0236c84166167f149c2e28548c6', |
77 'b7bdc73041b1852563deb1ef3f4153c2fe4484f2')) | 82 'b7bdc73041b1852563deb1ef3f4153c2fe4484f2')) |
78 self.assertEqual(node.hex(revsymbol(repo, 'the_branch').node()), | 83 # two possible hashes for backward compatibility with hg < 4.8 |
79 '4e256962fc5df545e2e0a51d0d1dc61c469127e6') | 84 self.assertTrue(node.hex(revsymbol(repo, 'the_branch').node()) in |
80 self.assertEqual(node.hex(revsymbol(repo, 'the_branch').parents()[0].node()), | 85 ('4e256962fc5df545e2e0a51d0d1dc61c469127e6', |
81 'f1ff5b860f5dbb9a59ad0921a79da77f10f25109') | 86 '13c5dc1514ad8619c589a8929bfe0ece5c00f18e')) |
87 self.assertTrue(node.hex(revsymbol(repo, 'the_branch').parents()[0].node()) in | |
88 ('f1ff5b860f5dbb9a59ad0921a79da77f10f25109', | |
89 '62f4e5fb583a405df3dae62c156461a0f44219f2')) | |
82 self.assertEqual(len(revsymbol(repo, 'tip').parents()), 1) | 90 self.assertEqual(len(revsymbol(repo, 'tip').parents()), 1) |
83 self.assertEqual(revsymbol(repo, 'tip'), revsymbol(repo, 'default')) | 91 self.assertEqual(revsymbol(repo, 'tip'), revsymbol(repo, 'default')) |
84 self.assertEqual(len(repo.heads()), 2) | 92 self.assertEqual(len(repo.heads()), 2) |
85 | 93 |
86 def test_file_mixed_with_branches(self): | 94 def test_file_mixed_with_branches(self): |
117 'tagged_vendor_and_oldest_not_trunk.svndump') | 125 'tagged_vendor_and_oldest_not_trunk.svndump') |
118 self.assertEqual(node.hex(revsymbol(repo, 'oldest').node()), | 126 self.assertEqual(node.hex(revsymbol(repo, 'oldest').node()), |
119 '926671740dec045077ab20f110c1595f935334fa') | 127 '926671740dec045077ab20f110c1595f935334fa') |
120 self.assertEqual(revsymbol(repo, 'tip').parents()[0].parents()[0], | 128 self.assertEqual(revsymbol(repo, 'tip').parents()[0].parents()[0], |
121 revsymbol(repo, 'oldest')) | 129 revsymbol(repo, 'oldest')) |
122 self.assertEqual(node.hex(revsymbol(repo, 'tip').node()), | 130 # two hashes for backward compatibility with hg < 4.8 because from 4.8, |
123 '1a6c3f30911d57abb67c257ec0df3e7bc44786f7') | 131 # we try hard to reuse the manifest |
132 self.assertTrue(node.hex(revsymbol(repo, 'tip').node()) in | |
133 ('1a6c3f30911d57abb67c257ec0df3e7bc44786f7', | |
134 'fa799f2781255dba874645e849d75af837472518')) | |
124 | 135 |
125 def test_propedit_with_nothing_else(self): | 136 def test_propedit_with_nothing_else(self): |
126 repo = self._load_fixture_and_fetch('branch_prop_edit.svndump') | 137 repo = self._load_fixture_and_fetch('branch_prop_edit.svndump') |
127 self.assertEqual(revsymbol(repo, 'tip').description(), 'Commit bogus propchange.') | 138 self.assertEqual(revsymbol(repo, 'tip').description(), 'Commit bogus propchange.') |
128 self.assertEqual(revsymbol(repo, 'tip').branch(), 'dev_branch') | 139 self.assertEqual(revsymbol(repo, 'tip').branch(), 'dev_branch') |
183 repo = self._load_fixture_and_fetch('two_heads.svndump') | 194 repo = self._load_fixture_and_fetch('two_heads.svndump') |
184 self.assertEqual(node.hex(repo[0].node()), | 195 self.assertEqual(node.hex(repo[0].node()), |
185 '434ed487136c1b47c1e8f952edb4dc5a8e6328df') | 196 '434ed487136c1b47c1e8f952edb4dc5a8e6328df') |
186 self.assertEqual(node.hex(revsymbol(repo, 'tip').node()), | 197 self.assertEqual(node.hex(revsymbol(repo, 'tip').node()), |
187 '1083037b18d85cd84fa211c5adbaeff0fea2cd9f') | 198 '1083037b18d85cd84fa211c5adbaeff0fea2cd9f') |
188 self.assertEqual(node.hex(revsymbol(repo, 'the_branch').node()), | 199 # two hashes to be compat with hg < 4.8 |
189 '4e256962fc5df545e2e0a51d0d1dc61c469127e6') | 200 self.assertTrue(node.hex(revsymbol(repo, 'the_branch').node()) in |
201 ('4e256962fc5df545e2e0a51d0d1dc61c469127e6', | |
202 '13c5dc1514ad8619c589a8929bfe0ece5c00f18e')) | |
190 self.assertEqual(revsymbol(repo, 'the_branch').extra()['convert_revision'], | 203 self.assertEqual(revsymbol(repo, 'the_branch').extra()['convert_revision'], |
191 'svn:df2126f7-00ab-4d49-b42c-7e981dde0bcf/branches/the_branch@5') | 204 'svn:df2126f7-00ab-4d49-b42c-7e981dde0bcf/branches/the_branch@5') |
192 self.assertEqual(node.hex(revsymbol(repo, 'the_branch').parents()[0].node()), | 205 self.assertTrue(node.hex(revsymbol(repo, 'the_branch').parents()[0].node()) in |
193 'f1ff5b860f5dbb9a59ad0921a79da77f10f25109') | 206 ('f1ff5b860f5dbb9a59ad0921a79da77f10f25109', |
207 '62f4e5fb583a405df3dae62c156461a0f44219f2')) | |
194 self.assertEqual(len(revsymbol(repo, 'tip').parents()), 1) | 208 self.assertEqual(len(revsymbol(repo, 'tip').parents()), 1) |
195 self.assertEqual(revsymbol(repo, 'default').extra()['convert_revision'], | 209 self.assertEqual(revsymbol(repo, 'default').extra()['convert_revision'], |
196 'svn:df2126f7-00ab-4d49-b42c-7e981dde0bcf/trunk@6') | 210 'svn:df2126f7-00ab-4d49-b42c-7e981dde0bcf/trunk@6') |
197 self.assertEqual(revsymbol(repo, 'tip'), revsymbol(repo, 'default')) | 211 self.assertEqual(revsymbol(repo, 'tip'), revsymbol(repo, 'default')) |
198 self.assertEqual(len(repo.heads()), 2) | 212 self.assertEqual(len(repo.heads()), 2) |
202 'tagged_vendor_and_oldest_not_trunk.svndump') | 216 'tagged_vendor_and_oldest_not_trunk.svndump') |
203 self.assertEqual(node.hex(revsymbol(repo, 'oldest').node()), | 217 self.assertEqual(node.hex(revsymbol(repo, 'oldest').node()), |
204 '926671740dec045077ab20f110c1595f935334fa') | 218 '926671740dec045077ab20f110c1595f935334fa') |
205 self.assertEqual(revsymbol(repo, 'tip').parents()[0].parents()[0], | 219 self.assertEqual(revsymbol(repo, 'tip').parents()[0].parents()[0], |
206 revsymbol(repo, 'oldest')) | 220 revsymbol(repo, 'oldest')) |
207 self.assertEqual(node.hex(revsymbol(repo, 'tip').node()), | 221 # two hashes to be compat with hg < 4.8 |
208 '1a6c3f30911d57abb67c257ec0df3e7bc44786f7') | 222 self.assertTrue(node.hex(revsymbol(repo, 'tip').node()) in |
223 ('1a6c3f30911d57abb67c257ec0df3e7bc44786f7', | |
224 'fa799f2781255dba874645e849d75af837472518')) | |
209 | 225 |
210 def test_empty_repo(self): | 226 def test_empty_repo(self): |
211 # This used to crash HgEditor because it could be closed without | 227 # This used to crash HgEditor because it could be closed without |
212 # having been initialized again. | 228 # having been initialized again. |
213 self._load_fixture_and_fetch('emptyrepo2.svndump') | 229 self._load_fixture_and_fetch('emptyrepo2.svndump') |