# HG changeset patch # User Pierre-Yves David # Date 2021-02-10 20:05:05 # Node ID 5cf00dc460739299784ca9e9855e0307ff0f576e # Parent d7685105e504d6d964b32adc7b11234841e5f54f hooks: forbid ':' in hook name The `:` character is a special separator in the config and it seems same do to the same for hooks. This is necessary to improve the experience around the HGPLAIN behavior change in 5.7. See next changesets for details. Differential Revision: https://phab.mercurial-scm.org/D9978 diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -1333,7 +1333,7 @@ coreconfigitem( ) coreconfigitem( b'hooks', - b'.*', + b'[^:]*', default=dynamicdefault, generic=True, ) diff --git a/mercurial/hook.py b/mercurial/hook.py --- a/mercurial/hook.py +++ b/mercurial/hook.py @@ -224,7 +224,11 @@ def _hookitems(ui, _untrusted=False): """return all hooks items ready to be sorted""" hooks = {} for name, cmd in ui.configitems(b'hooks', untrusted=_untrusted): - if name.startswith(b'priority.') or name.startswith(b'tonative.'): + if ( + name.startswith(b'priority.') + or name.startswith(b'tonative.') + or b':' in name + ): continue priority = ui.configint(b'hooks', b'priority.%s' % name, 0)