Patchwork [5,of,9] push: use `stepsdone` to control changegroup push through bundle10 or bundle20

login
register
mail settings
Submitter Pierre-Yves David
Date July 7, 2014, 11:02 a.m.
Message ID <92fa0cfd1a2d15f0e637.1404730923@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/5121/
State Accepted
Commit 7a7def851ba0e1de62df72d9437fbc60a2fe1ffc
Headers show

Comments

Pierre-Yves David - July 7, 2014, 11:02 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1404729031 -7200
#      Mon Jul 07 12:30:31 2014 +0200
# Node ID 92fa0cfd1a2d15f0e637ef33c4cf42e16f80c483
# Parent  269b990354a93fd1837caebfd3708af646596024
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.

Patch

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -137,12 +137,11 @@  def push(repo, remote, force=False, revs
                                                  pushop.outgoing)
                 if (pushop.repo.ui.configbool('experimental', 'bundle2-exp',
                                               False)
                     and pushop.remote.capable('bundle2-exp')):
                     _pushbundle2(pushop)
-                else:
-                    _pushchangeset(pushop)
+                _pushchangeset(pushop)
             _pushcomputecommonheads(pushop)
             _pushsyncphase(pushop)
             _pushobsolete(pushop)
         finally:
             if lock is not None:
@@ -209,10 +208,13 @@  def _pushcheckoutgoing(pushop):
 def _pushb2ctx(pushop, bundler):
     """handle changegroup push through bundle2
 
     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))
     cg = changegroup.getlocalbundle(pushop.repo, 'push', pushop.outgoing)
     cgpart = bundler.newpart('B2X:CHANGEGROUP', data=cg.getchunks())
@@ -261,10 +263,13 @@  def _pushbundle2extrareply(pushop, op, e
     """
     pass
 
 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
     bundlecaps = None
     # create a changegroup from local