# HG changeset patch # User Pierre-Yves David # Date 2017-06-28 15:41:25 # Node ID 78fc540c53e1ee7d3dc6dc7e32b739ce2dfeebf8 # Parent 99ce2f586cd4718fae25716e2858744da92c4524 pushrace: avoid crash on bare push when using concurrent push mode If the remote is empty, we do now bother computing head changes and the 'pushbranchmap' attribute stays at None. We now handle and tests this case. diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -730,7 +730,8 @@ def _pushb2ctxcheckheads(pushop, bundler # * if we don't push anything, there are nothing to check. if not pushop.force and pushop.outgoing.missingheads: allowunrelated = 'related' in bundler.capabilities.get('checkheads', ()) - if not allowunrelated: + emptyremote = pushop.pushbranchmap is None + if not allowunrelated or emptyremote: bundler.newpart('check:heads', data=iter(pushop.remoteheads)) else: affected = set() diff --git a/tests/test-push.t b/tests/test-push.t --- a/tests/test-push.t +++ b/tests/test-push.t @@ -297,3 +297,22 @@ Test push hook locking lock: user *, process * (*s) (glob) wlock: user *, process * (*s) (glob) +Test bare push with multiple race checking options +-------------------------------------------------- + + $ hg init test-bare-push-no-concurrency + $ hg init test-bare-push-unrelated-concurrency + $ hg -R test-revflag push -r 0 test-bare-push-no-concurrency --config server.concurrent-push-mode=strict + pushing to test-bare-push-no-concurrency + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + $ hg -R test-revflag push -r 0 test-bare-push-unrelated-concurrency --config server.concurrent-push-mode=check-related + pushing to test-bare-push-unrelated-concurrency + searching for changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files