[Updated] D9978: hooks: forbid ':' in hook name

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Thu Feb 11 16:34:32 UTC 2021


Closed by commit rHG5cf00dc46073: hooks: forbid ':' in hook name (authored by marmoute).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D9978?vs=25536&id=25549

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D9978/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D9978

AFFECTED FILES
  mercurial/configitems.py
  mercurial/hook.py

CHANGE DETAILS

diff --git a/mercurial/hook.py b/mercurial/hook.py
--- a/mercurial/hook.py
+++ b/mercurial/hook.py
@@ -224,7 +224,11 @@
     """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)
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -1333,7 +1333,7 @@
 )
 coreconfigitem(
     b'hooks',
-    b'.*',
+    b'[^:]*',
     default=dynamicdefault,
     generic=True,
 )



To: marmoute, #hg-reviewers
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210211/a466e979/attachment-0002.html>


More information about the Mercurial-patches mailing list