changeset 36231:72812ad205d1

wireprotoserver: return to using iscmd() method This was teased out in part so remotefilelog could disable an old protocol method over http. It got dropped accidentally in the recent refactor, but the code was all still present so it's easy to support for now. I think once we land remotefilelog, we should probably inline this function. Differential Revision: https://phab.mercurial-scm.org/D2285
author Augie Fackler <augie@google.com>
date Thu, 15 Feb 2018 17:30:43 -0500
parents 257f3651ada9
children 881596e51fca
files mercurial/wireprotoserver.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/wireprotoserver.py	Sun Feb 11 17:23:58 2018 -0800
+++ b/mercurial/wireprotoserver.py	Thu Feb 15 17:30:43 2018 -0500
@@ -170,6 +170,10 @@
             urlreq.quote(self._req.env.get('REMOTE_HOST', '')),
             urlreq.quote(self._req.env.get('REMOTE_USER', '')))
 
+# This method exists mostly so that extensions like remotefilelog can
+# disable a kludgey legacy method only over http. As of early 2018,
+# there are no other known users, so with any luck we can discard this
+# hook if remotefilelog becomes a first-party extension.
 def iscmd(cmd):
     return cmd in wireproto.commands
 
@@ -198,7 +202,7 @@
     # wire protocol requests to hgweb because it prevents hgweb from using
     # known wire protocol commands and it is less confusing for machine
     # clients.
-    if cmd not in wireproto.commands:
+    if not iscmd(cmd):
         return None
 
     proto = httpv1protocolhandler(req, repo.ui)