Patchwork D3294: bundlerepo: use command executor for wire protocol commands

login
register
mail settings
Submitter phabricator
Date April 13, 2018, 7:15 p.m.
Message ID <bf4fa14486747330cd541b6085021939@localhost.localdomain>
Download mbox | patch
Permalink /patch/30873/
State Not Applicable
Headers show

Comments

phabricator - April 13, 2018, 7:15 p.m.
indygreg updated this revision to Diff 8133.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3294?vs=8087&id=8133

REVISION DETAIL
  https://phab.mercurial-scm.org/D3294

AFFECTED FILES
  mercurial/bundlerepo.py

CHANGE DETAILS




To: indygreg, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -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()