Mercurial > public > mercurial-scm > hg-stable
diff mercurial/peer.py @ 33827: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 | b47fe9733d76 |
children | 56bb07a0b75c |
line wrap: on
line diff
--- a/mercurial/peer.py Sun Aug 06 18:00:19 2017 -0700 +++ b/mercurial/peer.py Thu Aug 10 20:58:28 2017 -0700 @@ -8,7 +8,6 @@ from __future__ import absolute_import -from .i18n import _ from . import ( error, util, @@ -95,46 +94,3 @@ return next(batchable) setattr(plain, 'batchable', f) return plain - -class peerrepository(object): - def iterbatch(self): - """Batch requests but allow iterating over the results. - - This is to allow interleaving responses with things like - progress updates for clients. - """ - return localiterbatcher(self) - - def capable(self, name): - '''tell whether repo supports named capability. - return False if not supported. - if boolean capability, return True. - if string capability, return string.''' - caps = self._capabilities() - if name in caps: - return True - name_eq = name + '=' - for cap in caps: - if cap.startswith(name_eq): - return cap[len(name_eq):] - return False - - def requirecap(self, name, purpose): - '''raise an exception if the given capability is not present''' - if not self.capable(name): - raise error.CapabilityError( - _('cannot %s; remote repository does not ' - 'support the %r capability') % (purpose, name)) - - def local(self): - '''return peer as a localrepo, or None''' - return None - - def peer(self): - return self - - def canpush(self): - return True - - def close(self): - pass