Patchwork D3289: streamclone: use command executor for wire protocol commands

login
register
mail settings
Submitter phabricator
Date April 12, 2018, 7:59 p.m.
Message ID <differential-rev-PHID-DREV-g3ryhakjrlo2o5psguwr-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/30823/
State Superseded
Headers show

Comments

phabricator - April 12, 2018, 7:59 p.m.
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/streamclone.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/streamclone.py b/mercurial/streamclone.py
--- a/mercurial/streamclone.py
+++ b/mercurial/streamclone.py
@@ -126,11 +126,21 @@ 
     # creation.
     rbranchmap = None
     if remote.capable('branchmap'):
-        rbranchmap = remote.branchmap()
+        with remote.commandexecutor() as e:
+            frbranchmap = e.callcommand('branchmap', {})
+
+        rbranchmap = frbranchmap.result()
 
     repo.ui.status(_('streaming all changes\n'))
 
-    fp = remote.stream_out()
+    with remote.commandexecutor() as e:
+        f = e.callcommand('stream_out', {})
+
+    # TODO strictly speaking, this should be inside the context manager
+    # because the context manager is supposed to ensure all wire state
+    # is flushed when exiting. But the legacy peers don't do this, so it
+    # doesn't matter.
+    fp = f.result()
     l = fp.readline()
     try:
         resp = int(l)