[PATCH STABLE] serve: move hg-ssh readonly logic into hg serve

Durham Goode durham at fb.com
Thu Apr 27 01:11:15 UTC 2017



On 4/26/17 5:50 PM, Durham Goode wrote:
>
> diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
> --- a/mercurial/dispatch.py
> +++ b/mercurial/dispatch.py
> @@ -214,6 +214,18 @@ def _runcatch(req):
>              # it's not a command that server operators expect to
>              # be safe to offer to users in a sandbox.
>              pass
> +
> +        if realcmd == 'serve' and '--read-only' in req.args:
> +            argindex = req.args.index('--read-only')
> +            del req.args[argindex]
> +
> +            if not req.ui:
> +                req.ui = uimod.ui.load()
> +            req.ui.setconfig('hooks', 'pretxnopen.rejectpush',
> +                             rejectpush, 'dispatch')
> +            req.ui.setconfig('hooks', 'prepushkey.rejectpush',
> +                             rejectpush, 'dispatch')
> +

Jun had some good feedback that we should use something more unique than 
'rejectpush' here, since users may have hooks with that name already.

I'll send a V2



More information about the Mercurial-devel mailing list