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

Pierre-Yves David pierre-yves.david at ens-lyon.org
Fri Mar 31 06:17:18 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 945e7d8bb4f7e8e5d7032b77d8cf45acd6d24349
# Parent  4c9bd7ff0722abc6ce410648c68a04222c91d836
# 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 945e7d8bb4f7
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