Mercurial > hgsubversion
comparison tests/test_push_command.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 | 1122a90e329a |
children | 8410a978c650 |
comparison
equal
deleted
inserted
replaced
1538:b0eca4d96a53 | 1539:0ebcc5bbf692 |
---|---|
275 data=path, | 275 data=path, |
276 islink=False, | 276 islink=False, |
277 isexec=False, | 277 isexec=False, |
278 copied=False) | 278 copied=False) |
279 oldtiphash = self.repo['default'].node() | 279 oldtiphash = self.repo['default'].node() |
280 ctx = context.memctx(self.repo, | 280 lr = self.repo |
281 (self.repo[0].node(), revlog.nullid,), | 281 ctx = context.memctx(lr, |
282 (lr[0].node(), revlog.nullid,), | |
282 'automated test', | 283 'automated test', |
283 ['gamma', ], | 284 ['gamma', ], |
284 filectxfn, | 285 filectxfn, |
285 'testy', | 286 'testy', |
286 '2008-12-21 16:32:00 -0500', | 287 '2008-12-21 16:32:00 -0500', |
287 {'branch': 'localbranch', }) | 288 {'branch': 'localbranch', }) |
288 newhash = self.repo.commitctx(ctx) | 289 newhash = lr.commitctx(ctx) |
289 ctx = context.memctx(self.repo, | 290 ctx = context.memctx(lr, |
290 (newhash, revlog.nullid), | 291 (newhash, revlog.nullid), |
291 'automated test2', | 292 'automated test2', |
292 ['delta', ], | 293 ['delta', ], |
293 filectxfn, | 294 filectxfn, |
294 'testy', | 295 'testy', |
295 '2008-12-21 16:32:00 -0500', | 296 '2008-12-21 16:32:00 -0500', |
296 {'branch': 'localbranch', }) | 297 {'branch': 'localbranch', }) |
297 newhash = self.repo.commitctx(ctx) | 298 newhash = lr.commitctx(ctx) |
298 repo = self.repo | 299 repo = self.repo |
299 hg.update(repo, newhash) | 300 hg.update(repo, newhash) |
300 commands.push(repo.ui, repo) | 301 commands.push(repo.ui, repo) |
301 self.assertEqual(self.repo['tip'].parents()[0].parents()[0].node(), oldtiphash) | 302 self.assertEqual(self.repo['tip'].parents()[0].parents()[0].node(), oldtiphash) |
302 self.assertEqual(self.repo['tip'].files(), ['delta', ]) | 303 self.assertEqual(self.repo['tip'].files(), ['delta', ]) |