##// END OF EJS Templates
sshpeer: use peer interface...
Gregory Szorc -
r33803:1f8460b5 default
parent child Browse files
Show More
@@ -13,6 +13,7 b' from .i18n import _'
13 from . import (
13 from . import (
14 error,
14 error,
15 pycompat,
15 pycompat,
16 repository,
16 util,
17 util,
17 wireproto,
18 wireproto,
18 )
19 )
@@ -114,10 +115,10 b' class doublepipe(object):'
114 def flush(self):
115 def flush(self):
115 return self._main.flush()
116 return self._main.flush()
116
117
117 class sshpeer(wireproto.wirepeer):
118 class sshpeer(wireproto.wirepeer, repository.legacypeer):
118 def __init__(self, ui, path, create=False):
119 def __init__(self, ui, path, create=False):
119 self._url = path
120 self._url = path
120 self.ui = ui
121 self._ui = ui
121 self._pipeo = self._pipei = self._pipee = None
122 self._pipeo = self._pipei = self._pipee = None
122
123
123 u = util.url(path, parsequery=False, parsefragment=False)
124 u = util.url(path, parsequery=False, parsefragment=False)
@@ -150,9 +151,39 b' class sshpeer(wireproto.wirepeer):'
150
151
151 self._validaterepo(sshcmd, args, remotecmd)
152 self._validaterepo(sshcmd, args, remotecmd)
152
153
154 # TODO remove this alias once peerrepository inheritance is removed.
155 self._capabilities = self.capabilities
156
157 # Begin of _basepeer interface.
158
159 @util.propertycache
160 def ui(self):
161 return self._ui
162
153 def url(self):
163 def url(self):
154 return self._url
164 return self._url
155
165
166 def local(self):
167 return None
168
169 def peer(self):
170 return self
171
172 def canpush(self):
173 return True
174
175 def close(self):
176 pass
177
178 # End of _basepeer interface.
179
180 # Begin of _basewirecommands interface.
181
182 def capabilities(self):
183 return self._caps
184
185 # End of _basewirecommands interface.
186
156 def _validaterepo(self, sshcmd, args, remotecmd):
187 def _validaterepo(self, sshcmd, args, remotecmd):
157 # cleanup up previous run
188 # cleanup up previous run
158 self._cleanup()
189 self._cleanup()
@@ -200,9 +231,6 b' class sshpeer(wireproto.wirepeer):'
200 self._caps.update(l[:-1].split(":")[1].split())
231 self._caps.update(l[:-1].split(":")[1].split())
201 break
232 break
202
233
203 def _capabilities(self):
204 return self._caps
205
206 def _readerr(self):
234 def _readerr(self):
207 _forwardoutput(self.ui, self._pipee)
235 _forwardoutput(self.ui, self._pipee)
208
236
General Comments 0
You need to be logged in to leave comments. Login now