Patchwork [10,of,14,"] hidden: add support to explicitly access hidden changesets via HTTP

mail settings
Submitter Pierre-Yves David
Date April 13, 2019, 11:40 p.m.
Message ID <>
Download mbox | patch
Permalink /patch/39603/
State Accepted
Headers show


Pierre-Yves David - April 13, 2019, 11:40 p.m.
# HG changeset patch
# User Manuel Jacob <>
# Date 1555113686 -7200
#      Sat Apr 13 02:01:26 2019 +0200
# Node ID 4931cc804f7a17c5a7b8cbf6b6a724930d7c47b7
# Parent  656de3a9bc06651bdeb914d646eee0a9916045ac
# EXP-Topic hgweb-obsolete
# Available At
#              hg pull -r 4931cc804f7a
hidden: add support to explicitly access hidden changesets via HTTP

We now detect hidden access request and validate them while handling http
wireprotocol command. This changeset only introduces server support. See next
changeset for client side code.

The mechanism we use for http wireprotocol is the same as the one used to lift
filtering for hgweb. For an initial implementation, the use of the global
`access-hidden` parameter in http url is simple and effective approach that:

* work around the lack of global parameters in protocol v1,
* reuse the mechanism in place for hgweb (that do not use the wireproto),
* can be safely ignored by older client (fitting the best effort contract).

This the feature is still experimental, we can easily update the implementation
details in the future. However, landing a first implementation now with it full
test harness will help test the feature in the wild and iterate on alternative
implementations is deemed necessary.


diff --git a/mercurial/ b/mercurial/
--- a/mercurial/
+++ b/mercurial/
@@ -434,7 +434,8 @@  def _callhttp(repo, req, res, proto, cmd
-    rsp = wireprotov1server.dispatch(repo, proto, cmd)
+    accesshidden = hgwebcommon.hashiddenaccess(repo, req)
+    rsp = wireprotov1server.dispatch(repo, proto, cmd, accesshidden)
     if isinstance(rsp, bytes):
         setresponse(HTTP_OK, HGTYPE, bodybytes=rsp)