changeset 21658:0696ca0a685b

pull: when remote supports it, pull phase data alongside changesets We use bundle2 to retrieve the remote phase data at the same time as changesets. This reduces the amount of requestis and should improve consistency as the server can ensure nothing changed between the retrieval of those parts.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 27 May 2014 15:44:46 -0700
parents 0ff44e06275d
children a319842539f5
files mercurial/exchange.py
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/exchange.py	Tue May 27 15:43:09 2014 -0700
+++ b/mercurial/exchange.py	Tue May 27 15:44:46 2014 -0700
@@ -532,12 +532,15 @@
     """pull data using bundle2
 
     For now, the only supported data are changegroup."""
+    remotecaps = bundle2.bundle2caps(pullop.remote)
     kwargs = {'bundlecaps': caps20to10(pullop.repo)}
     # pulling changegroup
     pullop.todosteps.remove('changegroup')
 
     kwargs['common'] = pullop.common
     kwargs['heads'] = pullop.heads or pullop.rheads
+    if 'b2x:listkeys' in remotecaps:
+        kwargs['listkeys'] = ['phase']
     if not pullop.fetch:
         pullop.repo.ui.status(_("no changes found\n"))
         pullop.cgresult = 0
@@ -557,6 +560,11 @@
         assert len(op.records['changegroup']) == 1
         pullop.cgresult = op.records['changegroup'][0]['return']
 
+    # processing phases change
+    for namespace, value in op.records['listkeys']:
+        if namespace == 'phases':
+            _pullapplyphases(pullop, value)
+
 def _pullbundle2extraprepare(pullop, kwargs):
     """hook function so that extensions can extend the getbundle call"""
     pass