[PATCH 3 of 4] hook: add support for disabling the shell to native command translation

Yuya Nishihara yuya at tcha.org
Tue Jul 10 08:36:58 EDT 2018


On Mon, 09 Jul 2018 11:27:46 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1531021086 14400
> #      Sat Jul 07 23:38:06 2018 -0400
> # Node ID 6c1736648339979cd4950d435cd696f0d4a4a186
> # Parent  f32405ce6d8e71c277c15e3a7598e1b406e6f452
> hook: add support for disabling the shell to native command translation

Queued this, too.


> +    [hooks]
> +    incoming.autobuild = /my/build/hook
> +    # disable translation to cmd.exe syntax for autobuild hook
> +    tonative.incoming.autobuild = False

It would be nice if we could use the :<sub-opt> syntax, but we can't because
<hookname>:<sub-opt> would be recognised as a hook by older Mercurial.

> -    cmd = procutil.shelltonative(cmd, env)
> +    if ui.configbool('hooks', 'tonative.%s' % name, pycompat.iswindows):
> +        ui.note(_('converting hook "%s" to native\n') % name)
> +        cmd = procutil.shelltonative(cmd, env)

This seems a bit verbose. Maybe it can be enabled only if cmd != orig cmd?


More information about the Mercurial-devel mailing list