comparison tests/test_utility_commands.py @ 1539:0ebcc5bbf692

tests: when making a `memctx`, make sure to use a single repo instance The way self.repo is dynamic produces bad lock behavior because the `context.memctx` ends up with a different instance than self in `localrepo.commitctx`, which means the callbacks in the `memctx` get an unlocked repo instance. This causes lock warning failures. When it's not a code freeze for core, we should probably: * Make lock failures hard, not just warnings * Stop holding a repo reference in memctx, or otherwise check it's the same instance as `self` during `localrepo.commitctx` That's my best guess based on the (very hard to debug) test failures here.
author Augie Fackler <raf@durin42.com>
date Sat, 28 Oct 2017 21:34:52 -0400
parents 180e0d5fba2e
children 8410a978c650
comparison
equal deleted inserted replaced
1538:b0eca4d96a53 1539:0ebcc5bbf692
165 path=path, 165 path=path,
166 data='added', 166 data='added',
167 islink=False, 167 islink=False,
168 isexec=False, 168 isexec=False,
169 copied=False) 169 copied=False)
170 ctx = context.memctx(self.repo, 170 lr = self.repo
171 ctx = context.memctx(lr,
171 parents, 172 parents,
172 'automated test', 173 'automated test',
173 ['added_bogus_file', 'other_added_file', ], 174 ['added_bogus_file', 'other_added_file', ],
174 filectxfn, 175 filectxfn,
175 'testy', 176 'testy',
176 '2008-12-21 16:32:00 -0500', 177 '2008-12-21 16:32:00 -0500',
177 {'branch': 'localbranch', }) 178 {'branch': 'localbranch', })
178 new = self.repo.commitctx(ctx) 179 new = lr.commitctx(ctx)
179 hg.update(self.repo, new) 180 hg.update(self.repo, new)
180 wrappers.parents(lambda x, y: None, u, self.repo, svn=True) 181 wrappers.parents(lambda x, y: None, u, self.repo, svn=True)
181 actual = u.popbuffer() 182 actual = u.popbuffer()
182 self.assertEqual(actual, '3:4e256962fc5d\n') 183 self.assertEqual(actual, '3:4e256962fc5d\n')
183 184
209 path=path, 210 path=path,
210 data='added', 211 data='added',
211 islink=False, 212 islink=False,
212 isexec=False, 213 isexec=False,
213 copied=False) 214 copied=False)
214 ctx = context.memctx(self.repo, 215 lr = self.repo
216 ctx = context.memctx(lr,
215 parents, 217 parents,
216 'automated test', 218 'automated test',
217 ['added_bogus_file', 'other_added_file', ], 219 ['added_bogus_file', 'other_added_file', ],
218 filectxfn, 220 filectxfn,
219 'testy', 221 'testy',
220 '2008-12-21 16:32:00 -0500', 222 '2008-12-21 16:32:00 -0500',
221 {'branch': 'localbranch', }) 223 {'branch': 'localbranch', })
222 new = self.repo.commitctx(ctx) 224 new = lr.commitctx(ctx)
223 hg.update(self.repo, new) 225 hg.update(self.repo, new)
224 u.pushbuffer() 226 u.pushbuffer()
225 commands.outgoing(u, self.repo, repourl(repo_path)) 227 commands.outgoing(u, self.repo, repourl(repo_path))
226 actual = u.popbuffer() 228 actual = u.popbuffer()
227 self.assertTrue(node.hex(self.repo['localbranch'].node())[:8] in actual) 229 self.assertTrue(node.hex(self.repo['localbranch'].node())[:8] in actual)
240 path=path, 242 path=path,
241 data='added', 243 data='added',
242 islink=False, 244 islink=False,
243 isexec=False, 245 isexec=False,
244 copied=False) 246 copied=False)
245 ctx = context.memctx(self.repo, 247 lr = self.repo
248 ctx = context.memctx(lr,
246 parents, 249 parents,
247 'automated test', 250 'automated test',
248 ['added_bogus_file', 'other_added_file', ], 251 ['added_bogus_file', 'other_added_file', ],
249 filectxfn, 252 filectxfn,
250 'testy', 253 'testy',
251 '2008-12-21 16:32:00 -0500', 254 '2008-12-21 16:32:00 -0500',
252 {'branch': 'localbranch', }) 255 {'branch': 'localbranch', })
253 self.repo.commitctx(ctx) 256 lr.commitctx(ctx)
254 self.assertEqual(self.repo['tip'].branch(), 'localbranch') 257 self.assertEqual(self.repo['tip'].branch(), 'localbranch')
255 beforerebasehash = self.repo['tip'].node() 258 beforerebasehash = self.repo['tip'].node()
256 hg.update(self.repo, 'tip') 259 hg.update(self.repo, 'tip')
257 wrappers.rebase(rebase.rebase, self.ui(), self.repo, svn=True) 260 wrappers.rebase(rebase.rebase, self.ui(), self.repo, svn=True)
258 self.assertEqual(self.repo['tip'].branch(), 'localbranch') 261 self.assertEqual(self.repo['tip'].branch(), 'localbranch')