# HG changeset patch # User Manuel Jacob # Date 1555113620 -7200 # Node ID 4cafe20b79b64135e02797585e6ddaf300024875 # Parent b15b6e2c3309769769d58ef4d51de86e29323511 hidden: support for explicitly accessing hidden changesets in wireproto server This installs the basic infrastructure to be able to access hidden changeset through the wireprotocol. Each wireprotocol server still needs a way to define how the feature is triggered. diff -r b15b6e2c3309 -r 4cafe20b79b6 mercurial/wireprotov1server.py --- a/mercurial/wireprotov1server.py Fri Apr 05 12:11:52 2019 +0200 +++ b/mercurial/wireprotov1server.py Sat Apr 13 02:00:20 2019 +0200 @@ -23,6 +23,7 @@ exchange, pushkey as pushkeymod, pycompat, + repoview, requirements as requirementsmod, streamclone, util, @@ -60,7 +61,7 @@ # wire protocol command can either return a string or one of these classes. -def getdispatchrepo(repo, proto, command): +def getdispatchrepo(repo, proto, command, accesshidden=False): """Obtain the repo used for processing wire protocol commands. The intent of this function is to serve as a monkeypatch point for @@ -68,11 +69,21 @@ specialized circumstances. """ viewconfig = repo.ui.config(b'server', b'view') + + # Only works if the filter actually supports being upgraded to show hidden + # changesets. + if ( + accesshidden + and viewconfig is not None + and viewconfig + b'.hidden' in repoview.filtertable + ): + viewconfig += b'.hidden' + return repo.filtered(viewconfig) -def dispatch(repo, proto, command): - repo = getdispatchrepo(repo, proto, command) +def dispatch(repo, proto, command, accesshidden=False): + repo = getdispatchrepo(repo, proto, command, accesshidden=accesshidden) func, spec = commands[command] args = proto.getargs(spec)