D3272: treediscovery: switch to command executor interface

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Wed Apr 11 20:12:55 EDT 2018


indygreg updated this revision to Diff 8039.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3272?vs=8038&id=8039

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

AFFECTED FILES
  mercurial/treediscovery.py

CHANGE DETAILS

diff --git a/mercurial/treediscovery.py b/mercurial/treediscovery.py
--- a/mercurial/treediscovery.py
+++ b/mercurial/treediscovery.py
@@ -36,7 +36,10 @@
     base = set()
 
     if not heads:
-        heads = remote.heads()
+        with remote.commandexecutor() as e:
+            fheads = e.callcommand('heads', {})
+
+        heads = fheads.result()
 
     if repo.changelog.tip() == nullid:
         base.add(nullid)
@@ -65,7 +68,10 @@
     # a 'branch' here is a linear segment of history, with four parts:
     # head, root, first parent, second parent
     # (a branch always has two parents (or none) by definition)
-    unknown = collections.deque(remote.branches(unknown))
+    with remote.commandexecutor() as e:
+        fbranches = e.callcommand('branches', {'nodes': unknown})
+
+    unknown = collections.deque(fbranches.result())
     while unknown:
         r = []
         while unknown:
@@ -107,7 +113,12 @@
             repo.ui.debug("request %d: %s\n" %
                         (reqcnt, " ".join(map(short, r))))
             for p in xrange(0, len(r), 10):
-                for b in remote.branches(r[p:p + 10]):
+                with remote.commandexecutor() as e:
+                    fbranches = e.callcommand('branches', {
+                        'nodes': r[p:p + 10],
+                    })
+
+                for b in fbranches.result():
                     repo.ui.debug("received %s:%s\n" %
                                   (short(b[0]), short(b[1])))
                     unknown.append(b)
@@ -117,7 +128,11 @@
         newsearch = []
         reqcnt += 1
         repo.ui.progress(_('searching'), reqcnt, unit=_('queries'))
-        for n, l in zip(search, remote.between(search)):
+
+        with remote.commandexecutor() as e:
+            fbetween = e.callcommand('between', {'pairs': search})
+
+        for n, l in zip(search, fbetween.result()):
             l.append(n[1])
             p = n[0]
             f = 1



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


More information about the Mercurial-devel mailing list