Mercurial > public > mercurial-scm > hg
comparison mercurial/sshpeer.py @ 33806:dedab036215d
wireproto: use new peer interface
The wirepeer class provides concrete implementations of peer interface
methods for calling wire protocol commands. It makes sense for this
class to inherit from the peer abstract base class. So we change
that.
Since httppeer and sshpeer have already been converted to the new
interface, peerrepository is no longer adding any value. So it has
been removed. httppeer and sshpeer have been updated to reflect the
loss of peerrepository and the inheritance of the abstract base
class in wirepeer.
The code changes in wirepeer are reordering of methods to group
by interface.
Some Python code in tests was updated to reflect changed APIs.
.. api::
peer.peerrepository has been removed. Use repository.peer abstract
base class to represent a peer repository.
Differential Revision: https://phab.mercurial-scm.org/D338
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 10 Aug 2017 20:58:28 -0700 |
parents | 1f8460b55986 |
children | c037fd655b47 |
comparison
equal
deleted
inserted
replaced
33805:f913e90f15a0 | 33806:dedab036215d |
---|---|
11 | 11 |
12 from .i18n import _ | 12 from .i18n import _ |
13 from . import ( | 13 from . import ( |
14 error, | 14 error, |
15 pycompat, | 15 pycompat, |
16 repository, | |
17 util, | 16 util, |
18 wireproto, | 17 wireproto, |
19 ) | 18 ) |
20 | 19 |
21 def _serverquote(s): | 20 def _serverquote(s): |
113 return self._main.close() | 112 return self._main.close() |
114 | 113 |
115 def flush(self): | 114 def flush(self): |
116 return self._main.flush() | 115 return self._main.flush() |
117 | 116 |
118 class sshpeer(wireproto.wirepeer, repository.legacypeer): | 117 class sshpeer(wireproto.wirepeer): |
119 def __init__(self, ui, path, create=False): | 118 def __init__(self, ui, path, create=False): |
120 self._url = path | 119 self._url = path |
121 self._ui = ui | 120 self._ui = ui |
122 self._pipeo = self._pipei = self._pipee = None | 121 self._pipeo = self._pipei = self._pipee = None |
123 | 122 |
148 res = ui.system(cmd, blockedtag='sshpeer') | 147 res = ui.system(cmd, blockedtag='sshpeer') |
149 if res != 0: | 148 if res != 0: |
150 self._abort(error.RepoError(_("could not create remote repo"))) | 149 self._abort(error.RepoError(_("could not create remote repo"))) |
151 | 150 |
152 self._validaterepo(sshcmd, args, remotecmd) | 151 self._validaterepo(sshcmd, args, remotecmd) |
153 | |
154 # TODO remove this alias once peerrepository inheritance is removed. | |
155 self._capabilities = self.capabilities | |
156 | 152 |
157 # Begin of _basepeer interface. | 153 # Begin of _basepeer interface. |
158 | 154 |
159 @util.propertycache | 155 @util.propertycache |
160 def ui(self): | 156 def ui(self): |