[PATCH 09 of 14 "] hidden: support for explicitly access hidden changeset in wireproto server

Pierre-Yves David pierre-yves.david at ens-lyon.org
Sat Apr 13 19:40:39 EDT 2019


# HG changeset patch
# User Manuel Jacob <me at manueljacob.de>
# Date 1555113620 -7200
#      Sat Apr 13 02:00:20 2019 +0200
# Node ID 656de3a9bc06651bdeb914d646eee0a9916045ac
# Parent  3ee63024cb9551aa025a3126b88ecaf973c3fbaf
# EXP-Topic hgweb-obsolete
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 656de3a9bc06
hidden: support for explicitly access hidden changeset in wireproto server

This install 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 --git a/mercurial/wireprotov1server.py b/mercurial/wireprotov1server.py
--- a/mercurial/wireprotov1server.py
+++ b/mercurial/wireprotov1server.py
@@ -25,6 +25,7 @@ from . import (
     exchange,
     pushkey as pushkeymod,
     pycompat,
+    repoview,
     streamclone,
     util,
     wireprototypes,
@@ -57,7 +58,7 @@ def clientcompressionsupport(proto):
 
 # 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
@@ -65,10 +66,17 @@ def getdispatchrepo(repo, proto, command
     specialized circumstances.
     """
     viewconfig = repo.ui.config('server', 'view')
+
+    # Only works if the filter actually support being upgraded to show visible
+    # changesets
+    if (accesshidden and viewconfig is not None
+            and viewconfig + '.hidden' in repoview.filtertable):
+        viewconfig += '.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)


More information about the Mercurial-devel mailing list