##// END OF EJS Templates
sshpeer: clean up API for sshpeer.__init__ (API)...
Gregory Szorc -
r35954:f8f03434 default
parent child Browse files
Show More
@@ -157,12 +157,21 b' def _makeconnection(ui, sshcmd, args, re'
157 return proc, stdin, stdout, stderr
157 return proc, stdin, stdout, stderr
158
158
159 class sshpeer(wireproto.wirepeer):
159 class sshpeer(wireproto.wirepeer):
160 def __init__(self, ui, path, create=False, sshstate=None):
160 def __init__(self, ui, url, proc, stdin, stdout, stderr):
161 self._url = path
161 """Create a peer from an existing SSH connection.
162
163 ``proc`` is a handle on the underlying SSH process.
164 ``stdin``, ``stdout``, and ``stderr`` are handles on the stdio
165 pipes for that process.
166 """
167 self._url = url
162 self._ui = ui
168 self._ui = ui
163 # self._subprocess is unused. Keeping a handle on the process
169 # self._subprocess is unused. Keeping a handle on the process
164 # holds a reference and prevents it from being garbage collected.
170 # holds a reference and prevents it from being garbage collected.
165 self._subprocess, self._pipei, self._pipeo, self._pipee = sshstate
171 self._subprocess = proc
172 self._pipeo = stdin
173 self._pipei = stdout
174 self._pipee = stderr
166
175
167 self._validaterepo()
176 self._validaterepo()
168
177
@@ -386,6 +395,4 b' def instance(ui, path, create):'
386 proc, stdin, stdout, stderr = _makeconnection(ui, sshcmd, args, remotecmd,
395 proc, stdin, stdout, stderr = _makeconnection(ui, sshcmd, args, remotecmd,
387 remotepath, sshenv)
396 remotepath, sshenv)
388
397
389 sshstate = (proc, stdout, stdin, stderr)
398 return sshpeer(ui, path, proc, stdin, stdout, stderr)
390
391 return sshpeer(ui, path, create=create, sshstate=sshstate)
@@ -69,8 +69,8 b' def main():'
69 checkobject(badpeer())
69 checkobject(badpeer())
70 checkobject(httppeer.httppeer(ui, 'http://localhost'))
70 checkobject(httppeer.httppeer(ui, 'http://localhost'))
71 checkobject(localrepo.localpeer(dummyrepo()))
71 checkobject(localrepo.localpeer(dummyrepo()))
72 checkobject(testingsshpeer(ui, 'ssh://localhost/foo', False,
72 checkobject(testingsshpeer(ui, 'ssh://localhost/foo', None, None, None,
73 (None, None, None, None)))
73 None))
74 checkobject(bundlerepo.bundlepeer(dummyrepo()))
74 checkobject(bundlerepo.bundlepeer(dummyrepo()))
75 checkobject(statichttprepo.statichttppeer(dummyrepo()))
75 checkobject(statichttprepo.statichttppeer(dummyrepo()))
76 checkobject(unionrepo.unionpeer(dummyrepo()))
76 checkobject(unionrepo.unionpeer(dummyrepo()))
General Comments 0
You need to be logged in to leave comments. Login now