comparison mercurial/sshpeer.py @ 37614:a81d02ea65db

wireproto: move version 1 peer functionality to standalone module (API) wireproto.py contains code for both the client and the server. There *should* be a somewhat strong separation between the two. This commit extracts the client-side code from wireproto.py into a new module - wireprotov1peer. Differential Revision: https://phab.mercurial-scm.org/D3259
author Gregory Szorc <gregory.szorc@gmail.com>
date Wed, 11 Apr 2018 12:49:08 -0700
parents aacfca6f9767
children 0664be4f0c1f
comparison
equal deleted inserted replaced
37613:96d735601ca1 37614:a81d02ea65db
16 pycompat, 16 pycompat,
17 util, 17 util,
18 wireproto, 18 wireproto,
19 wireprotoserver, 19 wireprotoserver,
20 wireprototypes, 20 wireprototypes,
21 wireprotov1peer,
21 ) 22 )
22 from .utils import ( 23 from .utils import (
23 procutil, 24 procutil,
24 ) 25 )
25 26
350 # Flush any output on stderr before proceeding. 351 # Flush any output on stderr before proceeding.
351 _forwardoutput(ui, stderr) 352 _forwardoutput(ui, stderr)
352 353
353 return protoname, caps 354 return protoname, caps
354 355
355 class sshv1peer(wireproto.wirepeer): 356 class sshv1peer(wireprotov1peer.wirepeer):
356 def __init__(self, ui, url, proc, stdin, stdout, stderr, caps, 357 def __init__(self, ui, url, proc, stdin, stdout, stderr, caps,
357 autoreadstderr=True): 358 autoreadstderr=True):
358 """Create a peer from an existing SSH connection. 359 """Create a peer from an existing SSH connection.
359 360
360 ``proc`` is a handle on the underlying SSH process. 361 ``proc`` is a handle on the underlying SSH process.
587 protoname) 588 protoname)
588 589
589 def instance(ui, path, create): 590 def instance(ui, path, create):
590 """Create an SSH peer. 591 """Create an SSH peer.
591 592
592 The returned object conforms to the ``wireproto.wirepeer`` interface. 593 The returned object conforms to the ``wireprotov1peer.wirepeer`` interface.
593 """ 594 """
594 u = util.url(path, parsequery=False, parsefragment=False) 595 u = util.url(path, parsequery=False, parsefragment=False)
595 if u.scheme != 'ssh' or not u.host or u.path is None: 596 if u.scheme != 'ssh' or not u.host or u.path is None:
596 raise error.RepoError(_("couldn't parse location %s") % path) 597 raise error.RepoError(_("couldn't parse location %s") % path)
597 598