Mercurial > hg
comparison mercurial/sshpeer.py @ 37320:39f7d4ee8bcd
repository: port peer interfaces to zope.interface
zope.interface is superior. Let's switch to it.
Unlike abc, which defines interfaces through a base class,
zope.interface uses different types for interfaces and for
implementations. So, we had to invent some new types to hold the
interfaces in order to separate the interface from its default
implementation.
The names here could probably be better. I've been wanting to
overhaul the peer interface for a while. And wire protocol version
2 will force that work. So anticipate a refactoring of these
interfaces in later commits.
With this commit, we no longer test abc interfaces in
test-check-interfaces.py, so code for that has been removed.
Differential Revision: https://phab.mercurial-scm.org/D3068
# no-check-commit because of stream_out()
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Fri, 30 Mar 2018 18:53:17 -0700 |
parents | a8a902d7176e |
children | e826fe7a08c7 |
comparison
equal
deleted
inserted
replaced
37319:36d17f37db91 | 37320:39f7d4ee8bcd |
---|---|
375 # response contains the length of that response. | 375 # response contains the length of that response. |
376 _FRAMED_COMMANDS = { | 376 _FRAMED_COMMANDS = { |
377 'batch', | 377 'batch', |
378 } | 378 } |
379 | 379 |
380 # Begin of _basepeer interface. | 380 # Begin of ipeerconnection interface. |
381 | 381 |
382 @util.propertycache | 382 @util.propertycache |
383 def ui(self): | 383 def ui(self): |
384 return self._ui | 384 return self._ui |
385 | 385 |
396 return True | 396 return True |
397 | 397 |
398 def close(self): | 398 def close(self): |
399 pass | 399 pass |
400 | 400 |
401 # End of _basepeer interface. | 401 # End of ipeerconnection interface. |
402 | 402 |
403 # Begin of _basewirecommands interface. | 403 # Begin of ipeercommands interface. |
404 | 404 |
405 def capabilities(self): | 405 def capabilities(self): |
406 return self._caps | 406 return self._caps |
407 | 407 |
408 # End of _basewirecommands interface. | 408 # End of ipeercommands interface. |
409 | 409 |
410 def _readerr(self): | 410 def _readerr(self): |
411 _forwardoutput(self.ui, self._pipee) | 411 _forwardoutput(self.ui, self._pipee) |
412 | 412 |
413 def _abort(self, exception): | 413 def _abort(self, exception): |