Show More
@@ -437,11 +437,13 class httppeer(wireprotov1peer.wirepeer) | |||
|
437 | 437 | |
|
438 | 438 | # End of ipeerconnection interface. |
|
439 | 439 | |
|
440 |
# Begin of ipeerc |
|
|
440 | # Begin of ipeercapabilities interface. | |
|
441 | 441 | |
|
442 | 442 | def capabilities(self): |
|
443 | 443 | return self._caps |
|
444 | 444 | |
|
445 | # End of ipeercapabilities interface. | |
|
446 | ||
|
445 | 447 | def _finish_inline_clone_bundle(self, stream): |
|
446 | 448 | # HTTP streams must hit the end to process the last empty |
|
447 | 449 | # chunk of Chunked-Encoding so the connection can be reused. |
@@ -449,8 +451,6 class httppeer(wireprotov1peer.wirepeer) | |||
|
449 | 451 | if chunk: |
|
450 | 452 | self._abort(error.ResponseError(_(b"unexpected response:"), chunk)) |
|
451 | 453 | |
|
452 | # End of ipeercommands interface. | |
|
453 | ||
|
454 | 454 | def _callstream(self, cmd, _compressible=False, **args): |
|
455 | 455 | args = pycompat.byteskwargs(args) |
|
456 | 456 |
@@ -205,6 +205,13 class ipeercapabilities(Protocol): | |||
|
205 | 205 | """ |
|
206 | 206 | |
|
207 | 207 | @abc.abstractmethod |
|
208 | def capabilities(self): | |
|
209 | """Obtain capabilities of the peer. | |
|
210 | ||
|
211 | Returns a set of string capabilities. | |
|
212 | """ | |
|
213 | ||
|
214 | @abc.abstractmethod | |
|
208 | 215 | def requirecap(self, name: bytes, purpose: bytes) -> None: |
|
209 | 216 | """Require a capability to be present. |
|
210 | 217 | |
@@ -228,13 +235,6 class ipeercommands(Protocol): | |||
|
228 | 235 | """ |
|
229 | 236 | |
|
230 | 237 | @abc.abstractmethod |
|
231 | def capabilities(self): | |
|
232 | """Obtain capabilities of the peer. | |
|
233 | ||
|
234 | Returns a set of string capabilities. | |
|
235 | """ | |
|
236 | ||
|
237 | @abc.abstractmethod | |
|
238 | 238 | def get_cached_bundle_inline(self, path): |
|
239 | 239 | """Retrieve a clonebundle across the wire. |
|
240 | 240 | |
@@ -470,9 +470,7 class peer(_ipeerconnection, ipeercapabi | |||
|
470 | 470 | self.path = path |
|
471 | 471 | |
|
472 | 472 | def capable(self, name: bytes) -> bool | bytes: |
|
473 | # TODO: this class should maybe subclass ipeercommands too, otherwise it | |
|
474 | # is assuming whatever uses this as a mixin also has this interface. | |
|
475 | caps = self.capabilities() # pytype: disable=attribute-error | |
|
473 | caps = self.capabilities() | |
|
476 | 474 | if name in caps: |
|
477 | 475 | return True |
|
478 | 476 |
@@ -339,14 +339,18 class localpeer(repository.peer): # (re | |||
|
339 | 339 | |
|
340 | 340 | # End of _basepeer interface. |
|
341 | 341 | |
|
342 | # Begin of ipeercapabilities interface. | |
|
343 | ||
|
344 | def capabilities(self): | |
|
345 | return self._caps | |
|
346 | ||
|
347 | # End of ipeercapabilities interface. | |
|
348 | ||
|
342 | 349 | # Begin of _basewirecommands interface. |
|
343 | 350 | |
|
344 | 351 | def branchmap(self): |
|
345 | 352 | return self._repo.branchmap() |
|
346 | 353 | |
|
347 | def capabilities(self): | |
|
348 | return self._caps | |
|
349 | ||
|
350 | 354 | def get_cached_bundle_inline(self, path): |
|
351 | 355 | # not needed with local peer |
|
352 | 356 | raise NotImplementedError |
@@ -439,12 +439,12 class sshv1peer(wireprotov1peer.wirepeer | |||
|
439 | 439 | |
|
440 | 440 | # End of ipeerconnection interface. |
|
441 | 441 | |
|
442 |
# Begin of ipeerc |
|
|
442 | # Begin of ipeercapabilities interface. | |
|
443 | 443 | |
|
444 | 444 | def capabilities(self): |
|
445 | 445 | return self._caps |
|
446 | 446 | |
|
447 |
# End of ipeerc |
|
|
447 | # End of ipeercapabilities interface. | |
|
448 | 448 | |
|
449 | 449 | def _readerr(self): |
|
450 | 450 | _forwardoutput(self.ui, self._pipee) |
General Comments 0
You need to be logged in to leave comments.
Login now