[PATCH 4 of 4] pull: adds a set of step that remain to be done during the pull
pierre-yves.david at ens-lyon.org
pierre-yves.david at ens-lyon.org
Wed Apr 2 15:21:47 CDT 2014
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at 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.
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:
More information about the Mercurial-devel
mailing list