mercurial/exchange.py
changeset 35761 1908d360f977
parent 35759 c24dad55ac19
child 35762 40df727b6f4f
--- a/mercurial/exchange.py	Wed Jan 17 16:38:32 2018 +0100
+++ b/mercurial/exchange.py	Wed Jan 17 16:32:05 2018 +0100
@@ -1450,24 +1450,32 @@
     For now, the only supported data are changegroup."""
     kwargs = {'bundlecaps': caps20to10(pullop.repo)}
 
+    # make ui easier to access
+    ui = pullop.repo.ui
+
     # At the moment we don't do stream clones over bundle2. If that is
     # implemented then here's where the check for that will go.
     streaming = False
 
+    # declare pull perimeters
+    kwargs['common'] = pullop.common
+    kwargs['heads'] = pullop.heads or pullop.rheads
+
     # pulling changegroup
     pullop.stepsdone.add('changegroup')
 
-    kwargs['common'] = pullop.common
-    kwargs['heads'] = pullop.heads or pullop.rheads
     kwargs['cg'] = pullop.fetch
 
-    ui = pullop.repo.ui
     legacyphase = 'phases' in ui.configlist('devel', 'legacy.exchange')
     hasbinaryphase = 'heads' in pullop.remotebundle2caps.get('phases', ())
     if (not legacyphase and hasbinaryphase):
         kwargs['phases'] = True
         pullop.stepsdone.add('phases')
 
+    if 'listkeys' in pullop.remotebundle2caps:
+        if 'phases' not in pullop.stepsdone:
+            kwargs['listkeys'] = ['phases']
+
     bookmarksrequested = False
     legacybookmark = 'bookmarks' in ui.configlist('devel', 'legacy.exchange')
     hasbinarybook = 'bookmarks' in pullop.remotebundle2caps
@@ -1482,8 +1490,6 @@
         bookmarksrequested = True
 
     if 'listkeys' in pullop.remotebundle2caps:
-        if 'phases' not in pullop.stepsdone:
-            kwargs['listkeys'] = ['phases']
         if 'request-bookmarks' not in pullop.stepsdone:
             # make sure to always includes bookmark data when migrating
             # `hg incoming --bundle` to using this function.