Mercurial > hgsubversion
diff 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 |
line wrap: on
line diff
--- a/tests/test_push_command.py +++ b/tests/test_push_command.py @@ -277,16 +277,17 @@ class PushTests(test_util.TestBase): isexec=False, copied=False) oldtiphash = self.repo['default'].node() - ctx = context.memctx(self.repo, - (self.repo[0].node(), revlog.nullid,), + lr = self.repo + ctx = context.memctx(lr, + (lr[0].node(), revlog.nullid,), 'automated test', ['gamma', ], filectxfn, 'testy', '2008-12-21 16:32:00 -0500', {'branch': 'localbranch', }) - newhash = self.repo.commitctx(ctx) - ctx = context.memctx(self.repo, + newhash = lr.commitctx(ctx) + ctx = context.memctx(lr, (newhash, revlog.nullid), 'automated test2', ['delta', ], @@ -294,7 +295,7 @@ class PushTests(test_util.TestBase): 'testy', '2008-12-21 16:32:00 -0500', {'branch': 'localbranch', }) - newhash = self.repo.commitctx(ctx) + newhash = lr.commitctx(ctx) repo = self.repo hg.update(repo, newhash) commands.push(repo.ui, repo)