changeset 21073:83ce71ef7804

sshpeer: add implementation of _calltwowaystream This implements the call needed by bundle2. The error handling is a bit flaky right now, but bundle2 error handling in general is still flaky anyway. Bundle2 is still disabled by default, I do not expect this to be a problem.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 15 Apr 2014 17:18:35 -0400
parents 0879352d67d8
children f8a0d82b0463
files mercurial/sshpeer.py
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/sshpeer.py	Tue Apr 15 17:19:46 2014 -0400
+++ b/mercurial/sshpeer.py	Tue Apr 15 17:18:35 2014 -0400
@@ -179,6 +179,18 @@
             return '', r
         return self._recv(), ''
 
+    def _calltwowaystream(self, cmd, fp, **args):
+        r = self._call(cmd, **args)
+        if r:
+            # XXX needs to be made better
+            raise util.Abort('unexpected remote reply: %s' % r)
+        while True:
+            d = fp.read(4096)
+            if not d:
+                break
+            self._send(d)
+        self._send("", flush=True)
+        return self.pipei
 
     def _recv(self):
         l = self.pipei.readline()