From patchwork Fri Mar 31 22:43:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3,of,7,V2] hook: fix name used in untrusted message From: Pierre-Yves David X-Patchwork-Id: 19883 Message-Id: To: mercurial-devel@mercurial-scm.org Date: Sat, 01 Apr 2017 00:43:31 +0200 # HG changeset patch # User Pierre-Yves David # 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