mercurial/wireprotov2server.py
changeset 37782 99accae4cc59
parent 37781 352932a11905
child 37783 9d818539abfa
--- a/mercurial/wireprotov2server.py	Mon Apr 16 21:52:33 2018 -0700
+++ b/mercurial/wireprotov2server.py	Mon Apr 16 22:00:52 2018 -0700
@@ -296,7 +296,7 @@
             res.setbodybytes(_('command in frame must match command in URL'))
             return True
 
-    rsp = wireproto.dispatch(repo, proto, command['command'])
+    rsp = dispatch(repo, proto, command['command'])
 
     res.status = b'200 OK'
     res.headers[b'Content-Type'] = FRAMINGTYPE
@@ -328,6 +328,17 @@
         raise error.ProgrammingError('unhandled event from reactor: %s' %
                                      action)
 
+def getdispatchrepo(repo, proto, command):
+    return repo.filtered('served')
+
+def dispatch(repo, proto, command):
+    repo = getdispatchrepo(repo, proto, command)
+
+    func, spec = wireproto.commandsv2[command]
+    args = proto.getargs(spec)
+
+    return func(repo, proto, **args)
+
 @zi.implementer(wireprototypes.baseprotocolhandler)
 class httpv2protocolhandler(object):
     def __init__(self, req, ui, args=None):