wireprotoserver: remove redirect() and restore() (API)
authorGregory Szorc <gregory.szorc@gmail.com>
Wed, 07 Feb 2018 20:20:11 -0800
changeset 36068 56fe8a3b2d52
parent 36067 caca3ac2ac04
child 36069 957e773614d0
wireprotoserver: remove redirect() and restore() (API) These methods on the protocol handler interface are no longer used in core. .. api:: redirect() and restore() have been removed from the wire protocol handler interface. Use mayberedirectstdio() instead. Differential Revision: https://phab.mercurial-scm.org/D2083
mercurial/wireprotoserver.py
--- a/mercurial/wireprotoserver.py	Wed Feb 07 20:19:06 2018 -0800
+++ b/mercurial/wireprotoserver.py	Wed Feb 07 20:20:11 2018 -0800
@@ -88,23 +88,6 @@
         won't be captured.
         """
 
-    @abc.abstractmethod
-    def redirect(self):
-        """may setup interception for stdout and stderr
-
-        See also the `restore` method."""
-
-    # If the `redirect` function does install interception, the `restore`
-    # function MUST be defined. If interception is not used, this function
-    # MUST NOT be defined.
-    #
-    # left commented here on purpose
-    #
-    #def restore(self):
-    #    """reinstall previous stdout and stderr and return intercepted stdout
-    #    """
-    #    raise NotImplementedError()
-
 def decodevaluefromheaders(req, headerprefix):
     """Decode a long value from multiple HTTP request headers.
 
@@ -181,15 +164,6 @@
             self._ui.fout = oldout
             self._ui.ferr = olderr
 
-    def redirect(self):
-        self._oldio = self._ui.fout, self._ui.ferr
-        self._ui.ferr = self._ui.fout = stringio()
-
-    def restore(self):
-        val = self._ui.fout.getvalue()
-        self._ui.ferr, self._ui.fout = self._oldio
-        return val
-
     def _client(self):
         return 'remote:%s:%s:%s' % (
             self._req.env.get('wsgi.url_scheme') or 'http',
@@ -425,9 +399,6 @@
     def mayberedirectstdio(self):
         yield None
 
-    def redirect(self):
-        pass
-
     def _client(self):
         client = encoding.environ.get('SSH_CLIENT', '').split(' ', 1)[0]
         return 'remote:ssh:' + client