diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -1029,6 +1029,9 @@ coreconfigitem('server', 'uncompressedallowsecret', default=False, ) +coreconfigitem('server', 'view', + default='served', +) coreconfigitem('server', 'validate', default=False, ) diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt --- a/mercurial/help/config.txt +++ b/mercurial/help/config.txt @@ -1990,6 +1990,12 @@ See also ``server.zliblevel``. +```view``` + Repository filter used when exchanging revisions with the peer. + + The default view (``served``) excludes secret and hidden changesets. + Another useful value is ``immutable`` (no draft, secret or hidden changesets). + ``smtp`` -------- diff --git a/mercurial/wireprotov1server.py b/mercurial/wireprotov1server.py --- a/mercurial/wireprotov1server.py +++ b/mercurial/wireprotov1server.py @@ -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) diff --git a/mercurial/wireprotov2server.py b/mercurial/wireprotov2server.py --- a/mercurial/wireprotov2server.py +++ b/mercurial/wireprotov2server.py @@ -342,7 +342,8 @@ action) def getdispatchrepo(repo, proto, command): - return repo.filtered('served') + viewconfig = repo.ui.config('server', 'view') + return repo.filtered(viewconfig) def dispatch(repo, proto, command, redirect): """Run a wire protocol command. diff --git a/tests/test-wireproto.py b/tests/test-wireproto.py --- a/tests/test-wireproto.py +++ b/tests/test-wireproto.py @@ -78,6 +78,9 @@ yield unmangle(f.value) class serverrepo(object): + def __init__(self, ui): + self.ui = ui + def greet(self, name): return b"Hello, " + name @@ -94,7 +97,7 @@ wireprotov1server.commands[b'greet'] = (greet, b'name') -srv = serverrepo() +srv = serverrepo(uimod.ui()) clt = clientpeer(srv, uimod.ui()) def printb(data, end=b'\n'):