diff -r 539f9708b980 -r 38dfd308fe9d mercurial/hook.py --- a/mercurial/hook.py Sat Jul 07 23:47:49 2018 -0400 +++ b/mercurial/hook.py Sat Jul 07 23:38:06 2018 -0400 @@ -139,7 +139,9 @@ v = stringutil.pprint(v) env['HG_' + k.upper()] = v - 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) ui.note(_("running hook %s: %s\n") % (name, cmd)) @@ -181,9 +183,11 @@ """return all hooks items ready to be sorted""" hooks = {} for name, cmd in ui.configitems('hooks', untrusted=_untrusted): - if not name.startswith('priority.'): - priority = ui.configint('hooks', 'priority.%s' % name, 0) - hooks[name] = (-priority, len(hooks), name, cmd) + if name.startswith('priority.') or name.startswith('tonative.'): + continue + + priority = ui.configint('hooks', 'priority.%s' % name, 0) + hooks[name] = (-priority, len(hooks), name, cmd) return hooks _redirect = False