Patchwork [4,of,4] pull: adds a set of step that remain to be done during the pull

login
register
mail settings
Submitter Pierre-Yves David
Date April 2, 2014, 8:21 p.m.
Message ID <721aa37d30b7e80b774f.1396470107@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/4203/
State Accepted
Headers show

Comments

Pierre-Yves David - April 2, 2014, 8:21 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1396403779 25200
#      Tue Apr 01 18:56:19 2014 -0700
# Node ID 721aa37d30b7e80b774fd184db6e64d6815cb21f
# Parent  80c088fd9e10acf3e8ffcd4e35ce964d528a84cd
pull: adds a set of step that remain to be done during the pull

With bundle2 we'll slowly move current step in a single bundle2 building and
calling (changegroup, phases, obsmarkers, bookmarks). But we need to keep the
old methods around for server that does not support bundle2. So we introduce
this set of step that remains to be done.
Matt Mackall - April 3, 2014, midnight
On Wed, 2014-04-02 at 13:21 -0700, pierre-yves.david@ens-lyon.org wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@fb.com>
> # Date 1396403779 25200
> #      Tue Apr 01 18:56:19 2014 -0700
> # Node ID 721aa37d30b7e80b774fd184db6e64d6815cb21f
> # Parent  80c088fd9e10acf3e8ffcd4e35ce964d528a84cd
> pull: adds a set of step that remain to be done during the pull

These are queued for default, thanks.

Patch

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -401,10 +401,12 @@  class pulloperation(object):
         self.rheads = None
         # list of missing changeset to fetch remotly
         self.fetch = None
         # result of changegroup pulling (used as returng code by pull)
         self.cgresult = None
+        # list of step remaining todo (related to future bundle2 usage)
+        self.todosteps = set(['changegroup', 'phases', 'obsmarkers'])
 
     @util.propertycache
     def pulledsubset(self):
         """heads of the set of changeset target by the pull"""
         # compute target subset
@@ -444,13 +446,16 @@  def pull(repo, remote, heads=None, force
             raise util.Abort(msg)
 
     lock = pullop.repo.lock()
     try:
         _pulldiscovery(pullop)
-        _pullchangeset(pullop)
-        _pullphase(pullop)
-        _pullobsolete(pullop)
+        if 'changegroup' in pullop.todosteps:
+            _pullchangeset(pullop)
+        if 'phases' in pullop.todosteps:
+            _pullphase(pullop)
+        if 'obsmarkers' in pullop.todosteps:
+            _pullobsolete(pullop)
         pullop.closetransaction()
     finally:
         pullop.releasetransaction()
         lock.release()
 
@@ -471,10 +476,11 @@  def _pulldiscovery(pullop):
 def _pullchangeset(pullop):
     """pull changeset from unbundle into the local repo"""
     # We delay the open of the transaction as late as possible so we
     # don't open transaction for nothing or you break future useful
     # rollback call
+    pullop.todosteps.remove('changegroup')
     if not pullop.fetch:
             pullop.repo.ui.status(_("no changes found\n"))
             pullop.cgresult = 0
             return
     pullop.gettransaction()
@@ -499,10 +505,11 @@  def _pullchangeset(pullop):
     pullop.cgresult = pullop.repo.addchangegroup(cg, 'pull',
                                                  pullop.remote.url())
 
 def _pullphase(pullop):
     # Get remote phases data from remote
+    pullop.todosteps.remove('phases')
     remotephases = pullop.remote.listkeys('phases')
     publishing = bool(remotephases.get('publishing', False))
     if remotephases and not publishing:
         # remote is new and unpublishing
         pheads, _dr = phases.analyzeremotephases(pullop.repo,
@@ -523,10 +530,11 @@  def _pullobsolete(pullop):
     The `gettransaction` is function that return the pull transaction, creating
     one if necessary. We return the transaction to inform the calling code that
     a new transaction have been created (when applicable).
 
     Exists mostly to allow overriding for experimentation purpose"""
+    pullop.todosteps.remove('obsmarkers')
     tr = None
     if obsolete._enabled:
         pullop.repo.ui.debug('fetching remote obsolete markers\n')
         remoteobs = pullop.remote.listkeys('obsolete')
         if 'dump0' in remoteobs: