comparison mercurial/hook.py @ 46490:86b019899737 stable

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
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 10 Feb 2021 21:05:05 +0100
parents 8fa87bce4929
children 7289eac777ec
comparison
equal deleted inserted replaced
46489:fb6eca7b8c63 46490:86b019899737
222 222
223 def _hookitems(ui, _untrusted=False): 223 def _hookitems(ui, _untrusted=False):
224 """return all hooks items ready to be sorted""" 224 """return all hooks items ready to be sorted"""
225 hooks = {} 225 hooks = {}
226 for name, cmd in ui.configitems(b'hooks', untrusted=_untrusted): 226 for name, cmd in ui.configitems(b'hooks', untrusted=_untrusted):
227 if name.startswith(b'priority.') or name.startswith(b'tonative.'): 227 if (
228 name.startswith(b'priority.')
229 or name.startswith(b'tonative.')
230 or b':' in name
231 ):
228 continue 232 continue
229 233
230 priority = ui.configint(b'hooks', b'priority.%s' % name, 0) 234 priority = ui.configint(b'hooks', b'priority.%s' % name, 0)
231 hooks[name] = ((-priority,), (len(hooks),), name, cmd) 235 hooks[name] = ((-priority,), (len(hooks),), name, cmd)
232 return hooks 236 return hooks