changeset 50480:afb27fc92717

hidden: support passing --hidden with `serve --stdio` This currently has no effect since the server code will filter the repository again. However, it is clearer to put this change in its own changeset. This will mostly impact ssh peers, clients being now able to pass --hidden when spawning the server. See the next changeset for details on how this is going to be used.
author Manuel Jacob <me@manueljacob.de>
date Sat, 13 Apr 2019 03:44:47 +0200
parents 4bddc2f72879
children 45c7bada5200
files mercurial/dispatch.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dispatch.py	Sat Apr 13 01:53:59 2019 +0200
+++ b/mercurial/dispatch.py	Sat Apr 13 03:44:47 2019 +0200
@@ -367,12 +367,18 @@
                 # shenanigans wherein a user does something like pass
                 # --debugger or --config=ui.debugger=1 as a repo
                 # name. This used to actually run the debugger.
+                nbargs = 4
+                hashiddenaccess = b'--hidden' in cmdargs
+                if hashiddenaccess:
+                    nbargs += 1
                 if (
-                    len(req.args) != 4
+                    len(req.args) != nbargs
                     or req.args[0] != b'-R'
                     or req.args[1].startswith(b'--')
                     or req.args[2] != b'serve'
                     or req.args[3] != b'--stdio'
+                    or hashiddenaccess
+                    and req.args[4] != b'--hidden'
                 ):
                     raise error.Abort(
                         _(b'potentially unsafe serve --stdio invocation: %s')