Show More
@@ -326,7 +326,7 b' def _performhandshake(ui, stdin, stdout,' | |||
|
326 | 326 | if not caps: |
|
327 | 327 | badresponse() |
|
328 | 328 | |
|
329 | return caps | |
|
329 | return protoname, caps | |
|
330 | 330 | |
|
331 | 331 | class sshv1peer(wireproto.wirepeer): |
|
332 | 332 | def __init__(self, ui, url, proc, stdin, stdout, stderr, caps): |
@@ -497,6 +497,12 b' class sshv1peer(wireproto.wirepeer):' | |||
|
497 | 497 | self._pipeo.flush() |
|
498 | 498 | self._readerr() |
|
499 | 499 | |
|
500 | class sshv2peer(sshv1peer): | |
|
501 | """A peer that speakers version 2 of the transport protocol.""" | |
|
502 | # Currently version 2 is identical to version 1 post handshake. | |
|
503 | # And handshake is performed before the peer is instantiated. So | |
|
504 | # we need no custom code. | |
|
505 | ||
|
500 | 506 | def instance(ui, path, create): |
|
501 | 507 | """Create an SSH peer. |
|
502 | 508 | |
@@ -532,9 +538,16 b' def instance(ui, path, create):' | |||
|
532 | 538 | remotepath, sshenv) |
|
533 | 539 | |
|
534 | 540 | try: |
|
535 | caps = _performhandshake(ui, stdin, stdout, stderr) | |
|
541 | protoname, caps = _performhandshake(ui, stdin, stdout, stderr) | |
|
536 | 542 | except Exception: |
|
537 | 543 | _cleanuppipes(ui, stdout, stdin, stderr) |
|
538 | 544 | raise |
|
539 | 545 | |
|
540 | return sshv1peer(ui, path, proc, stdin, stdout, stderr, caps) | |
|
546 | if protoname == wireprotoserver.SSHV1: | |
|
547 | return sshv1peer(ui, path, proc, stdin, stdout, stderr, caps) | |
|
548 | elif protoname == wireprotoserver.SSHV2: | |
|
549 | return sshv2peer(ui, path, proc, stdin, stdout, stderr, caps) | |
|
550 | else: | |
|
551 | _cleanuppipes(ui, stdout, stdin, stderr) | |
|
552 | raise error.RepoError(_('unknown version of SSH protocol: %s') % | |
|
553 | protoname) |
@@ -67,6 +67,8 b' def main():' | |||
|
67 | 67 | checkobject(localrepo.localpeer(dummyrepo())) |
|
68 | 68 | checkobject(sshpeer.sshv1peer(ui, 'ssh://localhost/foo', None, None, None, |
|
69 | 69 | None, None)) |
|
70 | checkobject(sshpeer.sshv2peer(ui, 'ssh://localhost/foo', None, None, None, | |
|
71 | None, None)) | |
|
70 | 72 | checkobject(bundlerepo.bundlepeer(dummyrepo())) |
|
71 | 73 | checkobject(statichttprepo.statichttppeer(dummyrepo())) |
|
72 | 74 | checkobject(unionrepo.unionpeer(dummyrepo())) |
General Comments 0
You need to be logged in to leave comments.
Login now