Mercurial > hgsubversion
comparison tests/test_fetch_mappings.py @ 1106:5cb6c95e0283 stable
Merge default and stable so I can do stable releases again.
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Tue, 11 Feb 2014 12:48:49 -0500 |
parents | 28116a204b6a |
children | 49791c40a8a5 |
comparison
equal
deleted
inserted
replaced
1020:b5b1fce26f1f | 1106:5cb6c95e0283 |
---|---|
14 from hgsubversion import svncommands | 14 from hgsubversion import svncommands |
15 from hgsubversion import util | 15 from hgsubversion import util |
16 from hgsubversion import verify | 16 from hgsubversion import verify |
17 | 17 |
18 class MapTests(test_util.TestBase): | 18 class MapTests(test_util.TestBase): |
19 stupid_mode_tests = True | |
20 | |
19 @property | 21 @property |
20 def authors(self): | 22 def authors(self): |
21 return os.path.join(self.tmpdir, 'authormap') | 23 return os.path.join(self.tmpdir, 'authormap') |
22 | 24 |
23 @property | 25 @property |
30 | 32 |
31 @property | 33 @property |
32 def tagmap(self): | 34 def tagmap(self): |
33 return os.path.join(self.tmpdir, 'tagmap') | 35 return os.path.join(self.tmpdir, 'tagmap') |
34 | 36 |
35 def test_author_map(self, stupid=False): | 37 def test_author_map(self): |
36 repo_path = self.load_svndump('replace_trunk_with_branch.svndump') | 38 repo_path = self.load_svndump('replace_trunk_with_branch.svndump') |
37 authormap = open(self.authors, 'w') | 39 authormap = open(self.authors, 'w') |
38 authormap.write('Augie=Augie Fackler <durin42@gmail.com> # stuffy\n') | 40 authormap.write('Augie=Augie Fackler <durin42@gmail.com> # stuffy\n') |
39 authormap.write("Augie Fackler <durin42@gmail.com>\n") | 41 authormap.write("Augie Fackler <durin42@gmail.com>\n") |
40 authormap.close() | 42 authormap.close() |
41 ui = self.ui(stupid) | 43 ui = self.ui() |
42 ui.setconfig('hgsubversion', 'authormap', self.authors) | 44 ui.setconfig('hgsubversion', 'authormap', self.authors) |
43 commands.clone(ui, test_util.fileurl(repo_path), | 45 commands.clone(ui, test_util.fileurl(repo_path), |
44 self.wc_path, authors=self.authors) | 46 self.wc_path, authors=self.authors) |
45 self.assertEqual(self.repo[0].user(), | 47 self.assertEqual(self.repo[0].user(), |
46 'Augie Fackler <durin42@gmail.com>') | 48 'Augie Fackler <durin42@gmail.com>') |
47 self.assertEqual(self.repo['tip'].user(), | 49 self.assertEqual(self.repo['tip'].user(), |
48 'evil@5b65bade-98f3-4993-a01f-b7a6710da339') | 50 'evil@5b65bade-98f3-4993-a01f-b7a6710da339') |
49 | 51 |
50 def test_author_map_stupid(self): | 52 def test_author_map_closing_author(self): |
51 self.test_author_map(True) | |
52 | |
53 def test_author_map_closing_author(self, stupid=False): | |
54 repo_path = self.load_svndump('replace_trunk_with_branch.svndump') | 53 repo_path = self.load_svndump('replace_trunk_with_branch.svndump') |
55 authormap = open(self.authors, 'w') | 54 authormap = open(self.authors, 'w') |
56 authormap.write("evil=Testy <test@test>") | 55 authormap.write("evil=Testy <test@test>") |
57 authormap.close() | 56 authormap.close() |
58 ui = self.ui(stupid) | 57 ui = self.ui() |
59 ui.setconfig('hgsubversion', 'authormap', self.authors) | 58 ui.setconfig('hgsubversion', 'authormap', self.authors) |
60 commands.clone(ui, test_util.fileurl(repo_path), | 59 commands.clone(ui, test_util.fileurl(repo_path), |
61 self.wc_path, authors=self.authors) | 60 self.wc_path, authors=self.authors) |
62 self.assertEqual(self.repo[0].user(), | 61 self.assertEqual(self.repo[0].user(), |
63 'Augie@5b65bade-98f3-4993-a01f-b7a6710da339') | 62 'Augie@5b65bade-98f3-4993-a01f-b7a6710da339') |
64 self.assertEqual(self.repo['tip'].user(), | 63 self.assertEqual(self.repo['tip'].user(), |
65 'Testy <test@test>') | 64 'Testy <test@test>') |
66 | 65 |
67 def test_author_map_closing_author_stupid(self): | 66 def test_author_map_no_author(self): |
68 self.test_author_map_closing_author(True) | 67 repo, repo_path = self.load_and_fetch('no-author.svndump') |
69 | |
70 def test_author_map_no_author(self, stupid=False): | |
71 repo, repo_path = self.load_and_fetch('no-author.svndump', | |
72 stupid=stupid) | |
73 users = set(self.repo[r].user() for r in self.repo) | 68 users = set(self.repo[r].user() for r in self.repo) |
74 expected_users = ['(no author)@%s' % self.repo.svnmeta().uuid] | 69 expected_users = ['(no author)@%s' % self.repo.svnmeta().uuid] |
75 self.assertEqual(sorted(users), expected_users) | 70 self.assertEqual(sorted(users), expected_users) |
76 test_util.rmtree(self.wc_path) | 71 test_util.rmtree(self.wc_path) |
77 | 72 |
78 authormap = open(self.authors, 'w') | 73 authormap = open(self.authors, 'w') |
79 authormap.write("(no author)=Testy <test@example.com>") | 74 authormap.write("(no author)=Testy <test@example.com>") |
80 authormap.close() | 75 authormap.close() |
81 ui = self.ui(stupid) | 76 ui = self.ui() |
82 ui.setconfig('hgsubversion', 'authormap', self.authors) | 77 ui.setconfig('hgsubversion', 'authormap', self.authors) |
83 commands.clone(ui, test_util.fileurl(repo_path), | 78 commands.clone(ui, test_util.fileurl(repo_path), |
84 self.wc_path, authors=self.authors) | 79 self.wc_path, authors=self.authors) |
85 users = set(self.repo[r].user() for r in self.repo) | 80 users = set(self.repo[r].user() for r in self.repo) |
86 expected_users = ['Testy <test@example.com>'] | 81 expected_users = ['Testy <test@example.com>'] |
87 self.assertEqual(sorted(users), expected_users) | 82 self.assertEqual(sorted(users), expected_users) |
88 | |
89 def test_author_map_no_author_stupid(self): | |
90 self.test_author_map_no_author(True) | |
91 | 83 |
92 def test_author_map_no_overwrite(self): | 84 def test_author_map_no_overwrite(self): |
93 cwd = os.path.dirname(__file__) | 85 cwd = os.path.dirname(__file__) |
94 orig = os.path.join(cwd, 'fixtures', 'author-map-test.txt') | 86 orig = os.path.join(cwd, 'fixtures', 'author-map-test.txt') |
95 new = open(self.authors, 'w') | 87 new = open(self.authors, 'w') |
99 fromself = set(test) | 91 fromself = set(test) |
100 test.load(orig) | 92 test.load(orig) |
101 all_tests = set(test) | 93 all_tests = set(test) |
102 self.assertEqual(fromself.symmetric_difference(all_tests), set()) | 94 self.assertEqual(fromself.symmetric_difference(all_tests), set()) |
103 | 95 |
104 def _loadwithfilemap(self, svndump, filemapcontent, stupid=False, | 96 def test_author_map_caseignore(self): |
97 repo_path = self.load_svndump('replace_trunk_with_branch.svndump') | |
98 authormap = open(self.authors, 'w') | |
99 authormap.write('augie=Augie Fackler <durin42@gmail.com> # stuffy\n') | |
100 authormap.write("Augie Fackler <durin42@gmail.com>\n") | |
101 authormap.close() | |
102 ui = self.ui() | |
103 ui.setconfig('hgsubversion', 'authormap', self.authors) | |
104 ui.setconfig('hgsubversion', 'caseignoreauthors', True) | |
105 commands.clone(ui, test_util.fileurl(repo_path), | |
106 self.wc_path, authors=self.authors) | |
107 self.assertEqual(self.repo[0].user(), | |
108 'Augie Fackler <durin42@gmail.com>') | |
109 self.assertEqual(self.repo['tip'].user(), | |
110 'evil@5b65bade-98f3-4993-a01f-b7a6710da339') | |
111 | |
112 def _loadwithfilemap(self, svndump, filemapcontent, | |
105 failonmissing=True): | 113 failonmissing=True): |
106 repo_path = self.load_svndump(svndump) | 114 repo_path = self.load_svndump(svndump) |
107 filemap = open(self.filemap, 'w') | 115 filemap = open(self.filemap, 'w') |
108 filemap.write(filemapcontent) | 116 filemap.write(filemapcontent) |
109 filemap.close() | 117 filemap.close() |
110 ui = self.ui(stupid) | 118 ui = self.ui() |
111 ui.setconfig('hgsubversion', 'filemap', self.filemap) | 119 ui.setconfig('hgsubversion', 'filemap', self.filemap) |
112 ui.setconfig('hgsubversion', 'failoninvalidreplayfile', 'true') | 120 ui.setconfig('hgsubversion', 'failoninvalidreplayfile', 'true') |
113 ui.setconfig('hgsubversion', 'failonmissing', failonmissing) | 121 ui.setconfig('hgsubversion', 'failonmissing', failonmissing) |
114 commands.clone(ui, test_util.fileurl(repo_path), | 122 commands.clone(ui, test_util.fileurl(repo_path), |
115 self.wc_path, filemap=self.filemap) | 123 self.wc_path, filemap=self.filemap) |
116 return self.repo | 124 return self.repo |
117 | 125 |
118 def test_file_map(self, stupid=False): | 126 @test_util.requiresreplay |
127 def test_file_map(self): | |
119 repo = self._loadwithfilemap('replace_trunk_with_branch.svndump', | 128 repo = self._loadwithfilemap('replace_trunk_with_branch.svndump', |
120 "include alpha\n", stupid) | 129 "include alpha\n") |
121 self.assertEqual(node.hex(repo[0].node()), '88e2c7492d83e4bf30fbb2dcbf6aa24d60ac688d') | 130 self.assertEqual(node.hex(repo[0].node()), '88e2c7492d83e4bf30fbb2dcbf6aa24d60ac688d') |
122 self.assertEqual(node.hex(repo['default'].node()), 'e524296152246b3837fe9503c83b727075835155') | 131 self.assertEqual(node.hex(repo['default'].node()), 'e524296152246b3837fe9503c83b727075835155') |
123 | 132 |
124 def test_file_map_stupid(self): | 133 @test_util.requiresreplay |
125 # TODO: re-enable test if we ever reinstate this feature | 134 def test_file_map_exclude(self): |
126 self.assertRaises(hgutil.Abort, self.test_file_map, True) | |
127 | |
128 def test_file_map_exclude(self, stupid=False): | |
129 repo = self._loadwithfilemap('replace_trunk_with_branch.svndump', | 135 repo = self._loadwithfilemap('replace_trunk_with_branch.svndump', |
130 "exclude alpha\n", stupid) | 136 "exclude alpha\n") |
131 self.assertEqual(node.hex(repo[0].node()), '2c48f3525926ab6c8b8424bcf5eb34b149b61841') | 137 self.assertEqual(node.hex(repo[0].node()), '2c48f3525926ab6c8b8424bcf5eb34b149b61841') |
132 self.assertEqual(node.hex(repo['default'].node()), 'b37a3c0297b71f989064d9b545b5a478bbed7cc1') | 138 self.assertEqual(node.hex(repo['default'].node()), 'b37a3c0297b71f989064d9b545b5a478bbed7cc1') |
133 | 139 |
134 def test_file_map_exclude_stupid(self): | 140 @test_util.requiresreplay |
135 # TODO: re-enable test if we ever reinstate this feature | |
136 self.assertRaises(hgutil.Abort, self.test_file_map_exclude, True) | |
137 | |
138 def test_file_map_rule_order(self): | 141 def test_file_map_rule_order(self): |
139 repo = self._loadwithfilemap('replace_trunk_with_branch.svndump', | 142 repo = self._loadwithfilemap('replace_trunk_with_branch.svndump', |
140 "exclude alpha\ninclude .\nexclude gamma\n") | 143 "exclude alpha\ninclude .\nexclude gamma\n") |
141 # The exclusion of alpha is overridden by the later rule to | 144 # The exclusion of alpha is overridden by the later rule to |
142 # include all of '.', whereas gamma should remain excluded | 145 # include all of '.', whereas gamma should remain excluded |
144 self.assertEqual(self.repo[0].manifest().keys(), | 147 self.assertEqual(self.repo[0].manifest().keys(), |
145 ['alpha', 'beta']) | 148 ['alpha', 'beta']) |
146 self.assertEqual(self.repo['default'].manifest().keys(), | 149 self.assertEqual(self.repo['default'].manifest().keys(), |
147 ['alpha', 'beta']) | 150 ['alpha', 'beta']) |
148 | 151 |
152 @test_util.requiresreplay | |
149 def test_file_map_copy(self): | 153 def test_file_map_copy(self): |
150 # Exercise excluding files copied from a non-excluded directory. | 154 # Exercise excluding files copied from a non-excluded directory. |
151 # There will be missing files as we are copying from an excluded | 155 # There will be missing files as we are copying from an excluded |
152 # directory. | 156 # directory. |
153 repo = self._loadwithfilemap('copies.svndump', "exclude dir2\n", | 157 repo = self._loadwithfilemap('copies.svndump', "exclude dir2\n", |
154 failonmissing=False) | 158 failonmissing=False) |
155 self.assertEqual(['dir/a', 'dir3/a'], list(repo[2])) | 159 self.assertEqual(['dir/a', 'dir3/a'], list(repo[2])) |
156 | 160 |
161 @test_util.requiresreplay | |
157 def test_file_map_exclude_copy_source_and_dest(self): | 162 def test_file_map_exclude_copy_source_and_dest(self): |
158 # dir3 is excluded and copied from dir2 which is also excluded. | 163 # dir3 is excluded and copied from dir2 which is also excluded. |
159 # dir3 files should not be marked as missing and fetched. | 164 # dir3 files should not be marked as missing and fetched. |
160 repo = self._loadwithfilemap('copies.svndump', | 165 repo = self._loadwithfilemap('copies.svndump', |
161 "exclude dir2\nexclude dir3\n") | 166 "exclude dir2\nexclude dir3\n") |
162 self.assertEqual(['dir/a'], list(repo[2])) | 167 self.assertEqual(['dir/a'], list(repo[2])) |
163 | 168 |
169 @test_util.requiresreplay | |
164 def test_file_map_include_file_exclude_dir(self): | 170 def test_file_map_include_file_exclude_dir(self): |
165 # dir3 is excluded but we want dir3/a, which is also copied from | 171 # dir3 is excluded but we want dir3/a, which is also copied from |
166 # an exluded dir2. dir3/a should be fetched. | 172 # an exluded dir2. dir3/a should be fetched. |
167 repo = self._loadwithfilemap('copies.svndump', | 173 repo = self._loadwithfilemap('copies.svndump', |
168 "include .\nexclude dir2\nexclude dir3\ninclude dir3/a\n", | 174 "include .\nexclude dir2\nexclude dir3\ninclude dir3/a\n", |
169 failonmissing=False) | 175 failonmissing=False) |
170 self.assertEqual(['dir/a', 'dir3/a'], list(repo[2])) | 176 self.assertEqual(['dir/a', 'dir3/a'], list(repo[2])) |
171 | 177 |
178 @test_util.requiresreplay | |
172 def test_file_map_delete_dest(self): | 179 def test_file_map_delete_dest(self): |
173 repo = self._loadwithfilemap('copies.svndump', 'exclude dir3\n') | 180 repo = self._loadwithfilemap('copies.svndump', 'exclude dir3\n') |
174 self.assertEqual(['dir/a', 'dir2/a'], list(repo[3])) | 181 self.assertEqual(['dir/a', 'dir2/a'], list(repo[3])) |
175 | 182 |
176 def test_branchmap(self, stupid=False): | 183 def test_branchmap(self): |
177 repo_path = self.load_svndump('branchmap.svndump') | 184 repo_path = self.load_svndump('branchmap.svndump') |
178 branchmap = open(self.branchmap, 'w') | 185 branchmap = open(self.branchmap, 'w') |
179 branchmap.write("badname = good-name # stuffy\n") | 186 branchmap.write("badname = good-name # stuffy\n") |
180 branchmap.write("feature = default\n") | 187 branchmap.write("feature = default\n") |
181 branchmap.close() | 188 branchmap.close() |
182 ui = self.ui(stupid) | 189 ui = self.ui() |
183 ui.setconfig('hgsubversion', 'branchmap', self.branchmap) | 190 ui.setconfig('hgsubversion', 'branchmap', self.branchmap) |
184 commands.clone(ui, test_util.fileurl(repo_path), | 191 commands.clone(ui, test_util.fileurl(repo_path), |
185 self.wc_path, branchmap=self.branchmap) | 192 self.wc_path, branchmap=self.branchmap) |
186 branches = set(self.repo[i].branch() for i in self.repo) | 193 branches = set(self.repo[i].branch() for i in self.repo) |
187 self.assert_('badname' not in branches) | 194 self.assert_('badname' not in branches) |
188 self.assert_('good-name' in branches) | 195 self.assert_('good-name' in branches) |
189 self.assertEquals(self.repo[2].branch(), 'default') | 196 self.assertEquals(self.repo[2].branch(), 'default') |
190 | 197 |
191 def test_branchmap_stupid(self): | 198 def test_branchmap_tagging(self): |
192 self.test_branchmap(True) | |
193 | |
194 def test_branchmap_tagging(self, stupid=False): | |
195 '''test tagging a renamed branch, which used to raise an exception''' | 199 '''test tagging a renamed branch, which used to raise an exception''' |
196 repo_path = self.load_svndump('commit-to-tag.svndump') | 200 repo_path = self.load_svndump('commit-to-tag.svndump') |
197 branchmap = open(self.branchmap, 'w') | 201 branchmap = open(self.branchmap, 'w') |
198 branchmap.write("magic = art\n") | 202 branchmap.write("magic = art\n") |
199 branchmap.close() | 203 branchmap.close() |
200 ui = self.ui(stupid) | 204 ui = self.ui() |
201 ui.setconfig('hgsubversion', 'branchmap', self.branchmap) | 205 ui.setconfig('hgsubversion', 'branchmap', self.branchmap) |
202 commands.clone(ui, test_util.fileurl(repo_path), | 206 commands.clone(ui, test_util.fileurl(repo_path), |
203 self.wc_path, branchmap=self.branchmap) | 207 self.wc_path, branchmap=self.branchmap) |
204 branches = set(self.repo[i].branch() for i in self.repo) | 208 branches = set(self.repo[i].branch() for i in self.repo) |
205 self.assertEquals(sorted(branches), ['art', 'closeme']) | 209 self.assertEquals(sorted(branches), ['art', 'closeme']) |
206 | 210 |
207 def test_branchmap_tagging_stupid(self): | 211 def test_branchmap_empty_commit(self): |
208 self.test_branchmap_tagging(True) | |
209 | |
210 def test_branchmap_empty_commit(self, stupid=False): | |
211 '''test mapping an empty commit on a renamed branch''' | 212 '''test mapping an empty commit on a renamed branch''' |
212 repo_path = self.load_svndump('propset-branch.svndump') | 213 repo_path = self.load_svndump('propset-branch.svndump') |
213 branchmap = open(self.branchmap, 'w') | 214 branchmap = open(self.branchmap, 'w') |
214 branchmap.write("the-branch = bob\n") | 215 branchmap.write("the-branch = bob\n") |
215 branchmap.close() | 216 branchmap.close() |
216 ui = self.ui(stupid) | 217 ui = self.ui() |
217 ui.setconfig('hgsubversion', 'branchmap', self.branchmap) | 218 ui.setconfig('hgsubversion', 'branchmap', self.branchmap) |
218 commands.clone(ui, test_util.fileurl(repo_path), | 219 commands.clone(ui, test_util.fileurl(repo_path), |
219 self.wc_path, branchmap=self.branchmap) | 220 self.wc_path, branchmap=self.branchmap) |
220 branches = set(self.repo[i].branch() for i in self.repo) | 221 branches = set(self.repo[i].branch() for i in self.repo) |
221 self.assertEquals(sorted(branches), ['bob', 'default']) | 222 self.assertEquals(sorted(branches), ['bob', 'default']) |
222 | 223 |
223 def test_branchmap_empty_commit_stupid(self): | 224 def test_branchmap_combine(self): |
224 '''test mapping an empty commit on a renamed branch (stupid)''' | |
225 self.test_branchmap_empty_commit(True) | |
226 | |
227 def test_branchmap_combine(self, stupid=False): | |
228 '''test combining two branches, but retaining heads''' | 225 '''test combining two branches, but retaining heads''' |
229 repo_path = self.load_svndump('branchmap.svndump') | 226 repo_path = self.load_svndump('branchmap.svndump') |
230 branchmap = open(self.branchmap, 'w') | 227 branchmap = open(self.branchmap, 'w') |
231 branchmap.write("badname = default\n") | 228 branchmap.write("badname = default\n") |
232 branchmap.write("feature = default\n") | 229 branchmap.write("feature = default\n") |
233 branchmap.close() | 230 branchmap.close() |
234 ui = self.ui(stupid) | 231 ui = self.ui() |
235 ui.setconfig('hgsubversion', 'branchmap', self.branchmap) | 232 ui.setconfig('hgsubversion', 'branchmap', self.branchmap) |
236 commands.clone(ui, test_util.fileurl(repo_path), | 233 commands.clone(ui, test_util.fileurl(repo_path), |
237 self.wc_path, branchmap=self.branchmap) | 234 self.wc_path, branchmap=self.branchmap) |
238 branches = set(self.repo[i].branch() for i in self.repo) | 235 branches = set(self.repo[i].branch() for i in self.repo) |
239 self.assertEquals(sorted(branches), ['default']) | 236 self.assertEquals(sorted(branches), ['default']) |
243 # test that the mapping does not affect branch info | 240 # test that the mapping does not affect branch info |
244 branches = self.repo.svnmeta().branches | 241 branches = self.repo.svnmeta().branches |
245 self.assertEquals(sorted(branches.keys()), | 242 self.assertEquals(sorted(branches.keys()), |
246 [None, 'badname', 'feature']) | 243 [None, 'badname', 'feature']) |
247 | 244 |
248 def test_branchmap_combine_stupid(self): | 245 def test_branchmap_rebuildmeta(self): |
249 '''test combining two branches, but retaining heads (stupid)''' | |
250 self.test_branchmap_combine(True) | |
251 | |
252 def test_branchmap_rebuildmeta(self, stupid=False): | |
253 '''test rebuildmeta on a branchmapped clone''' | 246 '''test rebuildmeta on a branchmapped clone''' |
254 repo_path = self.load_svndump('branchmap.svndump') | 247 repo_path = self.load_svndump('branchmap.svndump') |
255 branchmap = open(self.branchmap, 'w') | 248 branchmap = open(self.branchmap, 'w') |
256 branchmap.write("badname = dit\n") | 249 branchmap.write("badname = dit\n") |
257 branchmap.write("feature = dah\n") | 250 branchmap.write("feature = dah\n") |
258 branchmap.close() | 251 branchmap.close() |
259 ui = self.ui(stupid) | 252 ui = self.ui() |
260 ui.setconfig('hgsubversion', 'branchmap', self.branchmap) | 253 ui.setconfig('hgsubversion', 'branchmap', self.branchmap) |
261 commands.clone(ui, test_util.fileurl(repo_path), | 254 commands.clone(ui, test_util.fileurl(repo_path), |
262 self.wc_path, branchmap=self.branchmap) | 255 self.wc_path, branchmap=self.branchmap) |
263 originfo = self.repo.svnmeta().branches | 256 originfo = self.repo.svnmeta().branches |
264 | 257 |
265 # clone & rebuild | 258 # clone & rebuild |
266 ui = self.ui(stupid) | 259 ui = self.ui() |
267 src, dest = test_util.hgclone(ui, self.wc_path, self.wc_path + '_clone', | 260 src, dest = test_util.hgclone(ui, self.wc_path, self.wc_path + '_clone', |
268 update=False) | 261 update=False) |
269 src = test_util.getlocalpeer(src) | 262 src = test_util.getlocalpeer(src) |
270 dest = test_util.getlocalpeer(dest) | 263 dest = test_util.getlocalpeer(dest) |
271 svncommands.rebuildmeta(ui, dest, | 264 svncommands.rebuildmeta(ui, dest, |
274 # just check the keys; assume the contents are unaffected by the branch | 267 # just check the keys; assume the contents are unaffected by the branch |
275 # map and thus properly tested by other tests | 268 # map and thus properly tested by other tests |
276 self.assertEquals(sorted(src.svnmeta().branches), | 269 self.assertEquals(sorted(src.svnmeta().branches), |
277 sorted(dest.svnmeta().branches)) | 270 sorted(dest.svnmeta().branches)) |
278 | 271 |
279 def test_branchmap_rebuildmeta_stupid(self): | 272 def test_branchmap_verify(self): |
280 '''test rebuildmeta on a branchmapped clone (stupid)''' | |
281 self.test_branchmap_rebuildmeta(True) | |
282 | |
283 def test_branchmap_verify(self, stupid=False): | |
284 '''test verify on a branchmapped clone''' | 273 '''test verify on a branchmapped clone''' |
285 repo_path = self.load_svndump('branchmap.svndump') | 274 repo_path = self.load_svndump('branchmap.svndump') |
286 branchmap = open(self.branchmap, 'w') | 275 branchmap = open(self.branchmap, 'w') |
287 branchmap.write("badname = dit\n") | 276 branchmap.write("badname = dit\n") |
288 branchmap.write("feature = dah\n") | 277 branchmap.write("feature = dah\n") |
289 branchmap.close() | 278 branchmap.close() |
290 ui = self.ui(stupid) | 279 ui = self.ui() |
291 ui.setconfig('hgsubversion', 'branchmap', self.branchmap) | 280 ui.setconfig('hgsubversion', 'branchmap', self.branchmap) |
292 commands.clone(ui, test_util.fileurl(repo_path), | 281 commands.clone(ui, test_util.fileurl(repo_path), |
293 self.wc_path, branchmap=self.branchmap) | 282 self.wc_path, branchmap=self.branchmap) |
294 repo = self.repo | 283 repo = self.repo |
295 | 284 |
296 for r in repo: | 285 for r in repo: |
297 self.assertEquals(verify.verify(ui, repo, rev=r), 0) | 286 self.assertEquals(verify.verify(ui, repo, rev=r), 0) |
298 | |
299 def test_branchmap_verify_stupid(self): | |
300 '''test verify on a branchmapped clone (stupid)''' | |
301 self.test_branchmap_verify(True) | |
302 | 287 |
303 def test_branchmap_no_replacement(self): | 288 def test_branchmap_no_replacement(self): |
304 ''' | 289 ''' |
305 test that empty mappings are rejected | 290 test that empty mappings are rejected |
306 | 291 |
313 branchmap.write("closeme =\n") | 298 branchmap.write("closeme =\n") |
314 branchmap.close() | 299 branchmap.close() |
315 self.assertRaises(hgutil.Abort, | 300 self.assertRaises(hgutil.Abort, |
316 maps.BranchMap, self.ui(), self.branchmap) | 301 maps.BranchMap, self.ui(), self.branchmap) |
317 | 302 |
318 def test_tagmap(self, stupid=False): | 303 def test_tagmap(self): |
319 repo_path = self.load_svndump('basic_tag_tests.svndump') | 304 repo_path = self.load_svndump('basic_tag_tests.svndump') |
320 tagmap = open(self.tagmap, 'w') | 305 tagmap = open(self.tagmap, 'w') |
321 tagmap.write("tag_r3 = 3.x # stuffy\n") | 306 tagmap.write("tag_r3 = 3.x # stuffy\n") |
322 tagmap.write("copied_tag = \n") | 307 tagmap.write("copied_tag = \n") |
323 tagmap.close() | 308 tagmap.close() |
324 | 309 |
325 ui = self.ui(stupid) | 310 ui = self.ui() |
326 ui.setconfig('hgsubversion', 'tagmap', self.tagmap) | 311 ui.setconfig('hgsubversion', 'tagmap', self.tagmap) |
327 commands.clone(ui, test_util.fileurl(repo_path), | 312 commands.clone(ui, test_util.fileurl(repo_path), |
328 self.wc_path, tagmap=self.tagmap) | 313 self.wc_path, tagmap=self.tagmap) |
329 tags = self.repo.tags() | 314 tags = self.repo.tags() |
330 assert 'tag_r3' not in tags | 315 assert 'tag_r3' not in tags |
331 assert '3.x' in tags | 316 assert '3.x' in tags |
332 assert 'copied_tag' not in tags | 317 assert 'copied_tag' not in tags |
333 | 318 |
334 def test_tagmap_stupid(self): | 319 def test_tagren_changed(self): |
335 self.test_tagmap(True) | |
336 | |
337 def test_tagren_changed(self, stupid=False): | |
338 repo_path = self.load_svndump('commit-to-tag.svndump') | 320 repo_path = self.load_svndump('commit-to-tag.svndump') |
339 tagmap = open(self.tagmap, 'w') | 321 tagmap = open(self.tagmap, 'w') |
340 tagmap.write("edit-at-create = edit-past\n") | 322 tagmap.write("edit-at-create = edit-past\n") |
341 tagmap.write("also-edit = \n") | 323 tagmap.write("also-edit = \n") |
342 tagmap.write("will-edit = edit-future\n") | 324 tagmap.write("will-edit = edit-future\n") |
343 tagmap.close() | 325 tagmap.close() |
344 | 326 |
345 ui = self.ui(stupid) | 327 ui = self.ui() |
346 ui.setconfig('hgsubversion', 'tagmap', self.tagmap) | 328 ui.setconfig('hgsubversion', 'tagmap', self.tagmap) |
347 commands.clone(ui, test_util.fileurl(repo_path), | 329 commands.clone(ui, test_util.fileurl(repo_path), |
348 self.wc_path, tagmap=self.tagmap) | 330 self.wc_path, tagmap=self.tagmap) |
349 tags = self.repo.tags() | 331 tags = self.repo.tags() |
350 | 332 |
351 def test_tagren_changed_stupid(self): | 333 def test_empty_log_message(self): |
352 self.test_tagren_changed(True) | 334 repo, repo_path = self.load_and_fetch('empty-log-message.svndump') |
353 | |
354 def test_empty_log_message(self, stupid=False): | |
355 repo, repo_path = self.load_and_fetch('empty-log-message.svndump', | |
356 stupid=stupid) | |
357 | 335 |
358 self.assertEqual(repo['tip'].description(), '') | 336 self.assertEqual(repo['tip'].description(), '') |
359 | 337 |
360 test_util.rmtree(self.wc_path) | 338 test_util.rmtree(self.wc_path) |
361 | 339 |
362 ui = self.ui(stupid) | 340 ui = self.ui() |
363 ui.setconfig('hgsubversion', 'defaultmessage', 'blyf') | 341 ui.setconfig('hgsubversion', 'defaultmessage', 'blyf') |
364 commands.clone(ui, test_util.fileurl(repo_path), self.wc_path) | 342 commands.clone(ui, test_util.fileurl(repo_path), self.wc_path) |
365 | 343 |
366 self.assertEqual(self.repo['tip'].description(), 'blyf') | 344 self.assertEqual(self.repo['tip'].description(), 'blyf') |
367 | |
368 | |
369 def test_empty_log_message_stupid(self): | |
370 self.test_empty_log_message(True) | |
371 | |
372 def suite(): | |
373 return unittest.TestLoader().loadTestsFromTestCase(MapTests) |