changeset 20901:a26dfa7f534c

pull: add a set of steps that remain to be done during the pull With bundle2 we'll slowly move current steps into a single bundle2 building and call (changegroup, phases, obsmarkers, bookmarks). But we need to keep the old methods around for servers that do not support bundle2. So we introduce this set of steps that remains to be done.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 01 Apr 2014 18:56:19 -0700
parents cb37fb91bc5a
children 1e4fda2f5cf1
files mercurial/exchange.py
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/exchange.py	Tue Apr 01 17:35:25 2014 -0700
+++ b/mercurial/exchange.py	Tue Apr 01 18:56:19 2014 -0700
@@ -403,6 +403,8 @@
         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):
@@ -451,9 +453,12 @@
     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()
@@ -477,6 +482,7 @@
     # 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
@@ -505,6 +511,7 @@
 
 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:
@@ -529,6 +536,7 @@
     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')