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.
--- 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