diff mercurial/wireprotoserver.py @ 37296:78103e4138b1

wireproto: port protocol handler to zope.interface zope.interface is superior to the abc module. Let's port to it. As part of this, we add tests for interface conformance for classes implementing the interface. Differential Revision: https://phab.mercurial-scm.org/D2983
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 23 Mar 2018 16:24:53 -0700
parents 45b39c69fae0
children afcfdf53e4b5
line wrap: on
line diff
--- a/mercurial/wireprotoserver.py	Wed Mar 28 10:40:41 2018 -0700
+++ b/mercurial/wireprotoserver.py	Fri Mar 23 16:24:53 2018 -0700
@@ -12,6 +12,9 @@
 import threading
 
 from .i18n import _
+from .thirdparty.zope import (
+    interface as zi,
+)
 from . import (
     encoding,
     error,
@@ -58,7 +61,8 @@
 
     return ''.join(chunks)
 
-class httpv1protocolhandler(wireprototypes.baseprotocolhandler):
+@zi.implementer(wireprototypes.baseprotocolhandler)
+class httpv1protocolhandler(object):
     def __init__(self, req, ui, checkperm):
         self._req = req
         self._ui = ui
@@ -574,7 +578,8 @@
     },
 }
 
-class httpv2protocolhandler(wireprototypes.baseprotocolhandler):
+@zi.implementer(wireprototypes.baseprotocolhandler)
+class httpv2protocolhandler(object):
     def __init__(self, req, ui, args=None):
         self._req = req
         self._ui = ui
@@ -737,7 +742,8 @@
     fout.write(b'\n')
     fout.flush()
 
-class sshv1protocolhandler(wireprototypes.baseprotocolhandler):
+@zi.implementer(wireprototypes.baseprotocolhandler)
+class sshv1protocolhandler(object):
     """Handler for requests services via version 1 of SSH protocol."""
     def __init__(self, ui, fin, fout):
         self._ui = ui