diff mercurial/exchange.py @ 33138:78fc540c53e1

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.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 28 Jun 2017 17:41:25 +0200
parents 18c2489ac96d
children 0407a51b9d8c
line wrap: on
line diff
--- a/mercurial/exchange.py	Sun Jun 25 22:20:37 2017 -0700
+++ b/mercurial/exchange.py	Wed Jun 28 17:41:25 2017 +0200
@@ -730,7 +730,8 @@
     # * 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()