changeset 37643:1aa4d646d0de

bundlerepo: use command executor for wire protocol commands Differential Revision: https://phab.mercurial-scm.org/D3294
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 13 Apr 2018 11:21:55 -0700
parents d959277ff1b5
children 77c9ee77687c
files mercurial/bundlerepo.py
diffstat 1 files changed, 23 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bundlerepo.py	Wed Apr 11 17:51:40 2018 -0700
+++ b/mercurial/bundlerepo.py	Fri Apr 13 11:21:55 2018 -0700
@@ -540,17 +540,26 @@
                       and peer.capable('getbundle')
                       and peer.capable('bundle2'))
         if canbundle2:
-            kwargs = {}
-            kwargs[r'common'] = common
-            kwargs[r'heads'] = rheads
-            kwargs[r'bundlecaps'] = exchange.caps20to10(repo, role='client')
-            kwargs[r'cg'] = True
-            b2 = peer.getbundle('incoming', **kwargs)
-            fname = bundle = changegroup.writechunks(ui, b2._forwardchunks(),
-                                                     bundlename)
+            with peer.commandexecutor() as e:
+                b2 = e.callcommand('getbundle', {
+                    'source': 'incoming',
+                    'common': common,
+                    'heads': rheads,
+                    'bundlecaps': exchange.caps20to10(repo, role='client'),
+                    'cg': True,
+                }).result()
+
+                fname = bundle = changegroup.writechunks(ui,
+                                                         b2._forwardchunks(),
+                                                         bundlename)
         else:
             if peer.capable('getbundle'):
-                cg = peer.getbundle('incoming', common=common, heads=rheads)
+                with peer.commandexecutor() as e:
+                    cg = e.callcommand('getbundle', {
+                        'source': 'incoming',
+                        'common': common,
+                        'heads': rheads,
+                    }).result()
             elif onlyheads is None and not peer.capable('changegroupsubset'):
                 # compat with older servers when pulling all remote heads
 
@@ -594,7 +603,11 @@
 
     if bundlerepo:
         reponodes = [ctx.node() for ctx in bundlerepo[bundlerepo.firstnewrev:]]
-        remotephases = peer.listkeys('phases')
+
+        with peer.commandexecutor() as e:
+            remotephases = e.callcommand('listkeys', {
+                'namespace': 'phases',
+            }).result()
 
         pullop = exchange.pulloperation(bundlerepo, peer, heads=reponodes)
         pullop.trmanager = bundletransactionmanager()