# HG changeset patch # User Manuel Jacob # Date 1555119887 -7200 # Node ID afb27fc927176c7215a789b2fda23a9246e0d20f # Parent 4bddc2f7287905586045fde71e10cab9636f2180 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. diff -r 4bddc2f72879 -r afb27fc92717 mercurial/dispatch.py --- 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')