push: use `stepsdone` to control changegroup push through bundle10 or bundle20
authorPierre-Yves David <pierre-yves.david@fb.com>
Mon, 07 Jul 2014 12:30:31 +0200
changeset 21902 7a7def851ba0
parent 21901 8612c4ab7f54
child 21903 48f61cfb7576
push: use `stepsdone` to control changegroup push through bundle10 or bundle20 We use the newly introduced `pushop.stepsdone` attribute to inform older methods than changegroup have already been pushed using a newer method.
mercurial/exchange.py
--- a/mercurial/exchange.py	Wed Jul 02 12:48:54 2014 +0200
+++ b/mercurial/exchange.py	Mon Jul 07 12:30:31 2014 +0200
@@ -139,8 +139,7 @@
                                               False)
                     and pushop.remote.capable('bundle2-exp')):
                     _pushbundle2(pushop)
-                else:
-                    _pushchangeset(pushop)
+                _pushchangeset(pushop)
             _pushcomputecommonheads(pushop)
             _pushsyncphase(pushop)
             _pushobsolete(pushop)
@@ -211,6 +210,9 @@
 
     addchangegroup result is stored in the ``pushop.ret`` attribute.
     """
+    if 'changesets' in pushop.stepsdone:
+        return
+    pushop.stepsdone.add('changesets')
     # Send known heads to the server for race detection.
     if not pushop.force:
         bundler.newpart('B2X:CHECK:HEADS', data=iter(pushop.remoteheads))
@@ -263,6 +265,9 @@
 
 def _pushchangeset(pushop):
     """Make the actual push of changeset bundle to remote repo"""
+    if 'changesets' in pushop.stepsdone:
+        return
+    pushop.stepsdone.add('changesets')
     outgoing = pushop.outgoing
     unbundle = pushop.remote.capable('unbundle')
     # TODO: get bundlecaps from remote