comparison tests/test_fetch_mappings.py @ 1058:bc71d8c8fde9

filemap tests: use stupid mode metaclass & decorator
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Fri, 09 Aug 2013 23:43:04 +0200
parents d741f536f23a
children e015cd34168d
comparison
equal deleted inserted replaced
1057:cd256960b622 1058:bc71d8c8fde9
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 _loadwithfilemap(self, svndump, filemapcontent,
105 failonmissing=True): 97 failonmissing=True):
106 repo_path = self.load_svndump(svndump) 98 repo_path = self.load_svndump(svndump)
107 filemap = open(self.filemap, 'w') 99 filemap = open(self.filemap, 'w')
108 filemap.write(filemapcontent) 100 filemap.write(filemapcontent)
109 filemap.close() 101 filemap.close()
110 ui = self.ui(stupid) 102 ui = self.ui()
111 ui.setconfig('hgsubversion', 'filemap', self.filemap) 103 ui.setconfig('hgsubversion', 'filemap', self.filemap)
112 ui.setconfig('hgsubversion', 'failoninvalidreplayfile', 'true') 104 ui.setconfig('hgsubversion', 'failoninvalidreplayfile', 'true')
113 ui.setconfig('hgsubversion', 'failonmissing', failonmissing) 105 ui.setconfig('hgsubversion', 'failonmissing', failonmissing)
114 commands.clone(ui, test_util.fileurl(repo_path), 106 commands.clone(ui, test_util.fileurl(repo_path),
115 self.wc_path, filemap=self.filemap) 107 self.wc_path, filemap=self.filemap)
116 return self.repo 108 return self.repo
117 109
118 def test_file_map(self, stupid=False): 110 @test_util.requiresreplay
111 def test_file_map(self):
119 repo = self._loadwithfilemap('replace_trunk_with_branch.svndump', 112 repo = self._loadwithfilemap('replace_trunk_with_branch.svndump',
120 "include alpha\n", stupid) 113 "include alpha\n")
121 self.assertEqual(node.hex(repo[0].node()), '88e2c7492d83e4bf30fbb2dcbf6aa24d60ac688d') 114 self.assertEqual(node.hex(repo[0].node()), '88e2c7492d83e4bf30fbb2dcbf6aa24d60ac688d')
122 self.assertEqual(node.hex(repo['default'].node()), 'e524296152246b3837fe9503c83b727075835155') 115 self.assertEqual(node.hex(repo['default'].node()), 'e524296152246b3837fe9503c83b727075835155')
123 116
124 def test_file_map_stupid(self): 117 @test_util.requiresreplay
125 # TODO: re-enable test if we ever reinstate this feature 118 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', 119 repo = self._loadwithfilemap('replace_trunk_with_branch.svndump',
130 "exclude alpha\n", stupid) 120 "exclude alpha\n")
131 self.assertEqual(node.hex(repo[0].node()), '2c48f3525926ab6c8b8424bcf5eb34b149b61841') 121 self.assertEqual(node.hex(repo[0].node()), '2c48f3525926ab6c8b8424bcf5eb34b149b61841')
132 self.assertEqual(node.hex(repo['default'].node()), 'b37a3c0297b71f989064d9b545b5a478bbed7cc1') 122 self.assertEqual(node.hex(repo['default'].node()), 'b37a3c0297b71f989064d9b545b5a478bbed7cc1')
133 123
134 def test_file_map_exclude_stupid(self): 124 @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): 125 def test_file_map_rule_order(self):
139 repo = self._loadwithfilemap('replace_trunk_with_branch.svndump', 126 repo = self._loadwithfilemap('replace_trunk_with_branch.svndump',
140 "exclude alpha\ninclude .\nexclude gamma\n") 127 "exclude alpha\ninclude .\nexclude gamma\n")
141 # The exclusion of alpha is overridden by the later rule to 128 # The exclusion of alpha is overridden by the later rule to
142 # include all of '.', whereas gamma should remain excluded 129 # include all of '.', whereas gamma should remain excluded
144 self.assertEqual(self.repo[0].manifest().keys(), 131 self.assertEqual(self.repo[0].manifest().keys(),
145 ['alpha', 'beta']) 132 ['alpha', 'beta'])
146 self.assertEqual(self.repo['default'].manifest().keys(), 133 self.assertEqual(self.repo['default'].manifest().keys(),
147 ['alpha', 'beta']) 134 ['alpha', 'beta'])
148 135
136 @test_util.requiresreplay
149 def test_file_map_copy(self): 137 def test_file_map_copy(self):
150 # Exercise excluding files copied from a non-excluded directory. 138 # Exercise excluding files copied from a non-excluded directory.
151 # There will be missing files as we are copying from an excluded 139 # There will be missing files as we are copying from an excluded
152 # directory. 140 # directory.
153 repo = self._loadwithfilemap('copies.svndump', "exclude dir2\n", 141 repo = self._loadwithfilemap('copies.svndump', "exclude dir2\n",
154 failonmissing=False) 142 failonmissing=False)
155 self.assertEqual(['dir/a', 'dir3/a'], list(repo[2])) 143 self.assertEqual(['dir/a', 'dir3/a'], list(repo[2]))
156 144
145 @test_util.requiresreplay
157 def test_file_map_exclude_copy_source_and_dest(self): 146 def test_file_map_exclude_copy_source_and_dest(self):
158 # dir3 is excluded and copied from dir2 which is also excluded. 147 # dir3 is excluded and copied from dir2 which is also excluded.
159 # dir3 files should not be marked as missing and fetched. 148 # dir3 files should not be marked as missing and fetched.
160 repo = self._loadwithfilemap('copies.svndump', 149 repo = self._loadwithfilemap('copies.svndump',
161 "exclude dir2\nexclude dir3\n") 150 "exclude dir2\nexclude dir3\n")
162 self.assertEqual(['dir/a'], list(repo[2])) 151 self.assertEqual(['dir/a'], list(repo[2]))
163 152
153 @test_util.requiresreplay
164 def test_file_map_include_file_exclude_dir(self): 154 def test_file_map_include_file_exclude_dir(self):
165 # dir3 is excluded but we want dir3/a, which is also copied from 155 # dir3 is excluded but we want dir3/a, which is also copied from
166 # an exluded dir2. dir3/a should be fetched. 156 # an exluded dir2. dir3/a should be fetched.
167 repo = self._loadwithfilemap('copies.svndump', 157 repo = self._loadwithfilemap('copies.svndump',
168 "include .\nexclude dir2\nexclude dir3\ninclude dir3/a\n", 158 "include .\nexclude dir2\nexclude dir3\ninclude dir3/a\n",
169 failonmissing=False) 159 failonmissing=False)
170 self.assertEqual(['dir/a', 'dir3/a'], list(repo[2])) 160 self.assertEqual(['dir/a', 'dir3/a'], list(repo[2]))
171 161
162 @test_util.requiresreplay
172 def test_file_map_delete_dest(self): 163 def test_file_map_delete_dest(self):
173 repo = self._loadwithfilemap('copies.svndump', 'exclude dir3\n') 164 repo = self._loadwithfilemap('copies.svndump', 'exclude dir3\n')
174 self.assertEqual(['dir/a', 'dir2/a'], list(repo[3])) 165 self.assertEqual(['dir/a', 'dir2/a'], list(repo[3]))
175 166
176 def test_branchmap(self, stupid=False): 167 def test_branchmap(self):
177 repo_path = self.load_svndump('branchmap.svndump') 168 repo_path = self.load_svndump('branchmap.svndump')
178 branchmap = open(self.branchmap, 'w') 169 branchmap = open(self.branchmap, 'w')
179 branchmap.write("badname = good-name # stuffy\n") 170 branchmap.write("badname = good-name # stuffy\n")
180 branchmap.write("feature = default\n") 171 branchmap.write("feature = default\n")
181 branchmap.close() 172 branchmap.close()
182 ui = self.ui(stupid) 173 ui = self.ui()
183 ui.setconfig('hgsubversion', 'branchmap', self.branchmap) 174 ui.setconfig('hgsubversion', 'branchmap', self.branchmap)
184 commands.clone(ui, test_util.fileurl(repo_path), 175 commands.clone(ui, test_util.fileurl(repo_path),
185 self.wc_path, branchmap=self.branchmap) 176 self.wc_path, branchmap=self.branchmap)
186 branches = set(self.repo[i].branch() for i in self.repo) 177 branches = set(self.repo[i].branch() for i in self.repo)
187 self.assert_('badname' not in branches) 178 self.assert_('badname' not in branches)
188 self.assert_('good-name' in branches) 179 self.assert_('good-name' in branches)
189 self.assertEquals(self.repo[2].branch(), 'default') 180 self.assertEquals(self.repo[2].branch(), 'default')
190 181
191 def test_branchmap_stupid(self): 182 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''' 183 '''test tagging a renamed branch, which used to raise an exception'''
196 repo_path = self.load_svndump('commit-to-tag.svndump') 184 repo_path = self.load_svndump('commit-to-tag.svndump')
197 branchmap = open(self.branchmap, 'w') 185 branchmap = open(self.branchmap, 'w')
198 branchmap.write("magic = art\n") 186 branchmap.write("magic = art\n")
199 branchmap.close() 187 branchmap.close()
200 ui = self.ui(stupid) 188 ui = self.ui()
201 ui.setconfig('hgsubversion', 'branchmap', self.branchmap) 189 ui.setconfig('hgsubversion', 'branchmap', self.branchmap)
202 commands.clone(ui, test_util.fileurl(repo_path), 190 commands.clone(ui, test_util.fileurl(repo_path),
203 self.wc_path, branchmap=self.branchmap) 191 self.wc_path, branchmap=self.branchmap)
204 branches = set(self.repo[i].branch() for i in self.repo) 192 branches = set(self.repo[i].branch() for i in self.repo)
205 self.assertEquals(sorted(branches), ['art', 'closeme']) 193 self.assertEquals(sorted(branches), ['art', 'closeme'])
206 194
207 def test_branchmap_tagging_stupid(self): 195 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''' 196 '''test mapping an empty commit on a renamed branch'''
212 repo_path = self.load_svndump('propset-branch.svndump') 197 repo_path = self.load_svndump('propset-branch.svndump')
213 branchmap = open(self.branchmap, 'w') 198 branchmap = open(self.branchmap, 'w')
214 branchmap.write("the-branch = bob\n") 199 branchmap.write("the-branch = bob\n")
215 branchmap.close() 200 branchmap.close()
216 ui = self.ui(stupid) 201 ui = self.ui()
217 ui.setconfig('hgsubversion', 'branchmap', self.branchmap) 202 ui.setconfig('hgsubversion', 'branchmap', self.branchmap)
218 commands.clone(ui, test_util.fileurl(repo_path), 203 commands.clone(ui, test_util.fileurl(repo_path),
219 self.wc_path, branchmap=self.branchmap) 204 self.wc_path, branchmap=self.branchmap)
220 branches = set(self.repo[i].branch() for i in self.repo) 205 branches = set(self.repo[i].branch() for i in self.repo)
221 self.assertEquals(sorted(branches), ['bob', 'default']) 206 self.assertEquals(sorted(branches), ['bob', 'default'])
222 207
223 def test_branchmap_empty_commit_stupid(self): 208 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''' 209 '''test combining two branches, but retaining heads'''
229 repo_path = self.load_svndump('branchmap.svndump') 210 repo_path = self.load_svndump('branchmap.svndump')
230 branchmap = open(self.branchmap, 'w') 211 branchmap = open(self.branchmap, 'w')
231 branchmap.write("badname = default\n") 212 branchmap.write("badname = default\n")
232 branchmap.write("feature = default\n") 213 branchmap.write("feature = default\n")
233 branchmap.close() 214 branchmap.close()
234 ui = self.ui(stupid) 215 ui = self.ui()
235 ui.setconfig('hgsubversion', 'branchmap', self.branchmap) 216 ui.setconfig('hgsubversion', 'branchmap', self.branchmap)
236 commands.clone(ui, test_util.fileurl(repo_path), 217 commands.clone(ui, test_util.fileurl(repo_path),
237 self.wc_path, branchmap=self.branchmap) 218 self.wc_path, branchmap=self.branchmap)
238 branches = set(self.repo[i].branch() for i in self.repo) 219 branches = set(self.repo[i].branch() for i in self.repo)
239 self.assertEquals(sorted(branches), ['default']) 220 self.assertEquals(sorted(branches), ['default'])
243 # test that the mapping does not affect branch info 224 # test that the mapping does not affect branch info
244 branches = self.repo.svnmeta().branches 225 branches = self.repo.svnmeta().branches
245 self.assertEquals(sorted(branches.keys()), 226 self.assertEquals(sorted(branches.keys()),
246 [None, 'badname', 'feature']) 227 [None, 'badname', 'feature'])
247 228
248 def test_branchmap_combine_stupid(self): 229 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''' 230 '''test rebuildmeta on a branchmapped clone'''
254 repo_path = self.load_svndump('branchmap.svndump') 231 repo_path = self.load_svndump('branchmap.svndump')
255 branchmap = open(self.branchmap, 'w') 232 branchmap = open(self.branchmap, 'w')
256 branchmap.write("badname = dit\n") 233 branchmap.write("badname = dit\n")
257 branchmap.write("feature = dah\n") 234 branchmap.write("feature = dah\n")
258 branchmap.close() 235 branchmap.close()
259 ui = self.ui(stupid) 236 ui = self.ui()
260 ui.setconfig('hgsubversion', 'branchmap', self.branchmap) 237 ui.setconfig('hgsubversion', 'branchmap', self.branchmap)
261 commands.clone(ui, test_util.fileurl(repo_path), 238 commands.clone(ui, test_util.fileurl(repo_path),
262 self.wc_path, branchmap=self.branchmap) 239 self.wc_path, branchmap=self.branchmap)
263 originfo = self.repo.svnmeta().branches 240 originfo = self.repo.svnmeta().branches
264 241
265 # clone & rebuild 242 # clone & rebuild
266 ui = self.ui(stupid) 243 ui = self.ui()
267 src, dest = test_util.hgclone(ui, self.wc_path, self.wc_path + '_clone', 244 src, dest = test_util.hgclone(ui, self.wc_path, self.wc_path + '_clone',
268 update=False) 245 update=False)
269 src = test_util.getlocalpeer(src) 246 src = test_util.getlocalpeer(src)
270 dest = test_util.getlocalpeer(dest) 247 dest = test_util.getlocalpeer(dest)
271 svncommands.rebuildmeta(ui, dest, 248 svncommands.rebuildmeta(ui, dest,
274 # just check the keys; assume the contents are unaffected by the branch 251 # just check the keys; assume the contents are unaffected by the branch
275 # map and thus properly tested by other tests 252 # map and thus properly tested by other tests
276 self.assertEquals(sorted(src.svnmeta().branches), 253 self.assertEquals(sorted(src.svnmeta().branches),
277 sorted(dest.svnmeta().branches)) 254 sorted(dest.svnmeta().branches))
278 255
279 def test_branchmap_rebuildmeta_stupid(self): 256 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''' 257 '''test verify on a branchmapped clone'''
285 repo_path = self.load_svndump('branchmap.svndump') 258 repo_path = self.load_svndump('branchmap.svndump')
286 branchmap = open(self.branchmap, 'w') 259 branchmap = open(self.branchmap, 'w')
287 branchmap.write("badname = dit\n") 260 branchmap.write("badname = dit\n")
288 branchmap.write("feature = dah\n") 261 branchmap.write("feature = dah\n")
289 branchmap.close() 262 branchmap.close()
290 ui = self.ui(stupid) 263 ui = self.ui()
291 ui.setconfig('hgsubversion', 'branchmap', self.branchmap) 264 ui.setconfig('hgsubversion', 'branchmap', self.branchmap)
292 commands.clone(ui, test_util.fileurl(repo_path), 265 commands.clone(ui, test_util.fileurl(repo_path),
293 self.wc_path, branchmap=self.branchmap) 266 self.wc_path, branchmap=self.branchmap)
294 repo = self.repo 267 repo = self.repo
295 268
296 for r in repo: 269 for r in repo:
297 self.assertEquals(verify.verify(ui, repo, rev=r), 0) 270 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 271
303 def test_branchmap_no_replacement(self): 272 def test_branchmap_no_replacement(self):
304 ''' 273 '''
305 test that empty mappings are rejected 274 test that empty mappings are rejected
306 275
313 branchmap.write("closeme =\n") 282 branchmap.write("closeme =\n")
314 branchmap.close() 283 branchmap.close()
315 self.assertRaises(hgutil.Abort, 284 self.assertRaises(hgutil.Abort,
316 maps.BranchMap, self.ui(), self.branchmap) 285 maps.BranchMap, self.ui(), self.branchmap)
317 286
318 def test_tagmap(self, stupid=False): 287 def test_tagmap(self):
319 repo_path = self.load_svndump('basic_tag_tests.svndump') 288 repo_path = self.load_svndump('basic_tag_tests.svndump')
320 tagmap = open(self.tagmap, 'w') 289 tagmap = open(self.tagmap, 'w')
321 tagmap.write("tag_r3 = 3.x # stuffy\n") 290 tagmap.write("tag_r3 = 3.x # stuffy\n")
322 tagmap.write("copied_tag = \n") 291 tagmap.write("copied_tag = \n")
323 tagmap.close() 292 tagmap.close()
324 293
325 ui = self.ui(stupid) 294 ui = self.ui()
326 ui.setconfig('hgsubversion', 'tagmap', self.tagmap) 295 ui.setconfig('hgsubversion', 'tagmap', self.tagmap)
327 commands.clone(ui, test_util.fileurl(repo_path), 296 commands.clone(ui, test_util.fileurl(repo_path),
328 self.wc_path, tagmap=self.tagmap) 297 self.wc_path, tagmap=self.tagmap)
329 tags = self.repo.tags() 298 tags = self.repo.tags()
330 assert 'tag_r3' not in tags 299 assert 'tag_r3' not in tags
331 assert '3.x' in tags 300 assert '3.x' in tags
332 assert 'copied_tag' not in tags 301 assert 'copied_tag' not in tags
333 302
334 def test_tagmap_stupid(self): 303 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') 304 repo_path = self.load_svndump('commit-to-tag.svndump')
339 tagmap = open(self.tagmap, 'w') 305 tagmap = open(self.tagmap, 'w')
340 tagmap.write("edit-at-create = edit-past\n") 306 tagmap.write("edit-at-create = edit-past\n")
341 tagmap.write("also-edit = \n") 307 tagmap.write("also-edit = \n")
342 tagmap.write("will-edit = edit-future\n") 308 tagmap.write("will-edit = edit-future\n")
343 tagmap.close() 309 tagmap.close()
344 310
345 ui = self.ui(stupid) 311 ui = self.ui()
346 ui.setconfig('hgsubversion', 'tagmap', self.tagmap) 312 ui.setconfig('hgsubversion', 'tagmap', self.tagmap)
347 commands.clone(ui, test_util.fileurl(repo_path), 313 commands.clone(ui, test_util.fileurl(repo_path),
348 self.wc_path, tagmap=self.tagmap) 314 self.wc_path, tagmap=self.tagmap)
349 tags = self.repo.tags() 315 tags = self.repo.tags()
350 316
351 def test_tagren_changed_stupid(self): 317 def test_empty_log_message(self):
352 self.test_tagren_changed(True) 318 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 319
358 self.assertEqual(repo['tip'].description(), '') 320 self.assertEqual(repo['tip'].description(), '')
359 321
360 test_util.rmtree(self.wc_path) 322 test_util.rmtree(self.wc_path)
361 323
362 ui = self.ui(stupid) 324 ui = self.ui()
363 ui.setconfig('hgsubversion', 'defaultmessage', 'blyf') 325 ui.setconfig('hgsubversion', 'defaultmessage', 'blyf')
364 commands.clone(ui, test_util.fileurl(repo_path), self.wc_path) 326 commands.clone(ui, test_util.fileurl(repo_path), self.wc_path)
365 327
366 self.assertEqual(self.repo['tip'].description(), 'blyf') 328 self.assertEqual(self.repo['tip'].description(), 'blyf')
367 329
368 330
369 def test_empty_log_message_stupid(self):
370 self.test_empty_log_message(True)