[PATCH 3 of 7 V2] hook: fix name used in untrusted message

Pierre-Yves David pierre-yves.david at ens-lyon.org
Fri Mar 31 18:43:31 EDT 2017


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1490950925 -7200
#      Fri Mar 31 11:02:05 2017 +0200
# Node ID e033dfed0a983e7c4230fd16eb86bce0e2008659
# Parent  c81fb978412978f5d10879987ed5a571cb9b0904
# EXP-Topic hookname
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r e033dfed0a98
hook: fix name used in untrusted message

The name used in the message we issue when a hook is untrusted was using "name"
which is actually the hook type and not the name of the hook.

diff --git a/mercurial/hook.py b/mercurial/hook.py
--- a/mercurial/hook.py
+++ b/mercurial/hook.py
@@ -223,9 +223,9 @@ def runhooks(ui, repo, name, hooks, thro
             if cmd is _fromuntrusted:
                 if throw:
                     raise error.HookAbort(
-                        _('untrusted hook %s not executed') % name,
+                        _('untrusted hook %s not executed') % hname,
                         hint = _("see 'hg help config.trusted'"))
-                ui.warn(_('warning: untrusted hook %s not executed\n') % name)
+                ui.warn(_('warning: untrusted hook %s not executed\n') % hname)
                 r = 1
                 raised = False
             elif callable(cmd):
diff --git a/tests/test-hook.t b/tests/test-hook.t
--- a/tests/test-hook.t
+++ b/tests/test-hook.t
@@ -904,7 +904,7 @@ Non-blocking hook
   > txnclose.testing=echo txnclose hook called
   > EOF
   $ touch a && hg commit -Aqm a
-  warning: untrusted hook txnclose not executed
+  warning: untrusted hook txnclose.testing not executed
   $ hg log
   changeset:   0:3903775176ed
   tag:         tip
@@ -923,7 +923,7 @@ Non-blocking hook
   $ touch b && hg commit -Aqm a
   transaction abort!
   rollback completed
-  abort: untrusted hook pretxnclose not executed
+  abort: untrusted hook pretxnclose.testing not executed
   (see 'hg help config.trusted')
   [255]
   $ hg log


More information about the Mercurial-devel mailing list