Mercurial > hg
changeset 50442:4cafe20b79b6
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.
author | Manuel Jacob <me@manueljacob.de> |
---|---|
date | Sat, 13 Apr 2019 02:00:20 +0200 |
parents | b15b6e2c3309 |
children | 3b199593fedd |
files | mercurial/wireprotov1server.py |
diffstat | 1 files changed, 14 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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)