changeset 37638:65b86ee69383

streamclone: use command executor for wire protocol commands Differential Revision: https://phab.mercurial-scm.org/D3289
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 13 Apr 2018 11:14:19 -0700
parents 1964d2d1f421
children 0e50dda7e9c1
files mercurial/streamclone.py
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/streamclone.py	Fri Apr 13 11:13:05 2018 -0700
+++ b/mercurial/streamclone.py	Fri Apr 13 11:14:19 2018 -0700
@@ -126,11 +126,18 @@
     # creation.
     rbranchmap = None
     if remote.capable('branchmap'):
-        rbranchmap = remote.branchmap()
+        with remote.commandexecutor() as e:
+            rbranchmap = e.callcommand('branchmap', {}).result()
 
     repo.ui.status(_('streaming all changes\n'))
 
-    fp = remote.stream_out()
+    with remote.commandexecutor() as e:
+        fp = e.callcommand('stream_out', {}).result()
+
+    # TODO strictly speaking, this code should all 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.
     l = fp.readline()
     try:
         resp = int(l)