# HG changeset patch # User Pierre-Yves David # Date 2014-04-02 01:56:19 # Node ID a26dfa7f534c1e293a9a79b0a78726ab275d9d3e # Parent cb37fb91bc5a3d88df4d74789802abd3d94d83c3 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. diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -403,6 +403,8 @@ class pulloperation(object): 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 @@ def pull(repo, remote, heads=None, force 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 @@ def _pullchangeset(pullop): # 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 _pullchangeset(pullop): 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 @@ def _pullobsolete(pullop): 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')