# HG changeset patch # User Pierre-Yves David # Date 1397596715 14400 # Node ID 83ce71ef78045d76214acfee7f939cc4ffe5910c # Parent 0879352d67d8322e485006456d8adbfae3654d6e 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. diff -r 0879352d67d8 -r 83ce71ef7804 mercurial/sshpeer.py --- 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()