diff mercurial/wireprotov1server.py @ 41840:d6569f1e9b37

server: allow customizing the default repo filter hgweb has the (undocument) configuration option web.view that allows restricting visible revisions to immutable. This is useful for serving the same storage as publishing and non-publishing repo. Add the new server.view option to serve the same purpose by changing the default behavior of `getdispatchrepo`. Drop the hard-coded 'served' filter in the batch handler of v1 of the wire proto, this is a left-over from the days before `getdispatchrepo` existed. Differential Revision: https://phab.mercurial-scm.org/D5946
author Joerg Sonnenberger <joerg@bec.de>
date Tue, 12 Feb 2019 19:08:17 +0100
parents 9cb51e74e9ad
children 566daffc607d
line wrap: on
line diff
--- a/mercurial/wireprotov1server.py	Sat Mar 02 05:24:35 2019 +0530
+++ b/mercurial/wireprotov1server.py	Tue Feb 12 19:08:17 2019 +0100
@@ -64,7 +64,8 @@
     extensions that need commands to operate on different repo views under
     specialized circumstances.
     """
-    return repo.filtered('served')
+    viewconfig = repo.ui.config('server', 'view')
+    return repo.filtered(viewconfig)
 
 def dispatch(repo, proto, command):
     repo = getdispatchrepo(repo, proto, command)
@@ -166,7 +167,6 @@
 @wireprotocommand('batch', 'cmds *', permission='pull')
 def batch(repo, proto, cmds, others):
     unescapearg = wireprototypes.unescapebatcharg
-    repo = repo.filtered("served")
     res = []
     for pair in cmds.split(';'):
         op, args = pair.split(' ', 1)