localrepo: subclass the new `repository.ipeercommandexecutor` Protocol class
authorMatt Harbison <matt_harbison@yahoo.com>
Thu, 24 Oct 2024 20:26:25 -0400
changeset 52496 e123c8a26a70
parent 52495 6412dcec52d3
child 52497 61f70a6ab645
localrepo: subclass the new `repository.ipeercommandexecutor` Protocol class This is the same transformation as 3a90a6fd710d did for dirstate, but the CamelCase naming was already cleaned up here. See 4ef6dbc27a99 for the benefits of explicit subclassing. Since we're direct subclassing here and there are only a few methods on this interface, also make them abstract like was done in ef119f914fc1.
mercurial/interfaces/repository.py
mercurial/localrepo.py
mercurial/wireprotov1peer.py
--- a/mercurial/interfaces/repository.py	Wed Oct 23 15:58:32 2024 -0400
+++ b/mercurial/interfaces/repository.py	Thu Oct 24 20:26:25 2024 -0400
@@ -344,6 +344,7 @@
     outstanding requests are waited on.
     """
 
+    @abc.abstractmethod
     def callcommand(self, name, args):
         """Request that a named command be executed.
 
@@ -366,6 +367,7 @@
         until all command requests have been issued.
         """
 
+    @abc.abstractmethod
     def sendcommands(self):
         """Trigger submission of queued command requests.
 
@@ -376,6 +378,7 @@
         When called, no more new commands may be issued with this executor.
         """
 
+    @abc.abstractmethod
     def close(self):
         """Signal that this command request is finished.
 
--- a/mercurial/localrepo.py	Wed Oct 23 15:58:32 2024 -0400
+++ b/mercurial/localrepo.py	Thu Oct 24 20:26:25 2024 -0400
@@ -258,7 +258,7 @@
 legacycaps = moderncaps.union({b'changegroupsubset'})
 
 
-class localcommandexecutor:  # (repository.ipeercommandexecutor)
+class localcommandexecutor(repository.ipeercommandexecutor):
     def __init__(self, peer):
         self._peer = peer
         self._sent = False
--- a/mercurial/wireprotov1peer.py	Wed Oct 23 15:58:32 2024 -0400
+++ b/mercurial/wireprotov1peer.py	Thu Oct 24 20:26:25 2024 -0400
@@ -107,8 +107,7 @@
         return self.result(timeout)
 
 
-# @interfaceutil.implementer(repository.ipeercommandexecutor)
-class peerexecutor:
+class peerexecutor(repository.ipeercommandexecutor):
     def __init__(self, peer):
         self._peer = peer
         self._sent = False