# HG changeset patch # User Pierre-Yves David # Date 2014-05-27 22:44:46 # Node ID 0696ca0a685b7f5e1490d5835e13d1834b1c2a44 # Parent 0ff44e06275da28a804e9a2e34e7d7e65ca32fea 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. diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -532,12 +532,15 @@ def _pullbundle2(pullop): """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 @@ def _pullbundle2(pullop): 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