Show More
@@ -337,13 +337,16 b' def _performhandshake(ui, stdin, stdout,' | |||||
337 | return protoname, caps |
|
337 | return protoname, caps | |
338 |
|
338 | |||
339 | class sshv1peer(wireproto.wirepeer): |
|
339 | class sshv1peer(wireproto.wirepeer): | |
340 |
def __init__(self, ui, url, proc, stdin, stdout, stderr, caps |
|
340 | def __init__(self, ui, url, proc, stdin, stdout, stderr, caps, | |
|
341 | autoreadstderr=True): | |||
341 | """Create a peer from an existing SSH connection. |
|
342 | """Create a peer from an existing SSH connection. | |
342 |
|
343 | |||
343 | ``proc`` is a handle on the underlying SSH process. |
|
344 | ``proc`` is a handle on the underlying SSH process. | |
344 | ``stdin``, ``stdout``, and ``stderr`` are handles on the stdio |
|
345 | ``stdin``, ``stdout``, and ``stderr`` are handles on the stdio | |
345 | pipes for that process. |
|
346 | pipes for that process. | |
346 | ``caps`` is a set of capabilities supported by the remote. |
|
347 | ``caps`` is a set of capabilities supported by the remote. | |
|
348 | ``autoreadstderr`` denotes whether to automatically read from | |||
|
349 | stderr and to forward its output. | |||
347 | """ |
|
350 | """ | |
348 | self._url = url |
|
351 | self._url = url | |
349 | self._ui = ui |
|
352 | self._ui = ui | |
@@ -353,8 +356,9 b' class sshv1peer(wireproto.wirepeer):' | |||||
353 |
|
356 | |||
354 | # And we hook up our "doublepipe" wrapper to allow querying |
|
357 | # And we hook up our "doublepipe" wrapper to allow querying | |
355 | # stderr any time we perform I/O. |
|
358 | # stderr any time we perform I/O. | |
356 | stdout = doublepipe(ui, util.bufferedinputpipe(stdout), stderr) |
|
359 | if autoreadstderr: | |
357 |
|
|
360 | stdout = doublepipe(ui, util.bufferedinputpipe(stdout), stderr) | |
|
361 | stdin = doublepipe(ui, stdin, stderr) | |||
358 |
|
362 | |||
359 | self._pipeo = stdin |
|
363 | self._pipeo = stdin | |
360 | self._pipei = stdout |
|
364 | self._pipei = stdout | |
@@ -531,7 +535,7 b' class sshv2peer(sshv1peer):' | |||||
531 | # And handshake is performed before the peer is instantiated. So |
|
535 | # And handshake is performed before the peer is instantiated. So | |
532 | # we need no custom code. |
|
536 | # we need no custom code. | |
533 |
|
537 | |||
534 | def makepeer(ui, path, proc, stdin, stdout, stderr): |
|
538 | def makepeer(ui, path, proc, stdin, stdout, stderr, autoreadstderr=True): | |
535 | """Make a peer instance from existing pipes. |
|
539 | """Make a peer instance from existing pipes. | |
536 |
|
540 | |||
537 | ``path`` and ``proc`` are stored on the eventual peer instance and may |
|
541 | ``path`` and ``proc`` are stored on the eventual peer instance and may | |
@@ -552,9 +556,11 b' def makepeer(ui, path, proc, stdin, stdo' | |||||
552 | raise |
|
556 | raise | |
553 |
|
557 | |||
554 | if protoname == wireprotoserver.SSHV1: |
|
558 | if protoname == wireprotoserver.SSHV1: | |
555 |
return sshv1peer(ui, path, proc, stdin, stdout, stderr, caps |
|
559 | return sshv1peer(ui, path, proc, stdin, stdout, stderr, caps, | |
|
560 | autoreadstderr=autoreadstderr) | |||
556 | elif protoname == wireprotoserver.SSHV2: |
|
561 | elif protoname == wireprotoserver.SSHV2: | |
557 |
return sshv2peer(ui, path, proc, stdin, stdout, stderr, caps |
|
562 | return sshv2peer(ui, path, proc, stdin, stdout, stderr, caps, | |
|
563 | autoreadstderr=autoreadstderr) | |||
558 | else: |
|
564 | else: | |
559 | _cleanuppipes(ui, stdout, stdin, stderr) |
|
565 | _cleanuppipes(ui, stdout, stdin, stderr) | |
560 | raise error.RepoError(_('unknown version of SSH protocol: %s') % |
|
566 | raise error.RepoError(_('unknown version of SSH protocol: %s') % |
General Comments 0
You need to be logged in to leave comments.
Login now