[PATCH 4 of 7] hook: use 'htype' in 'runhooks'

Pierre-Yves David pierre-yves.david at ens-lyon.org
Fri Mar 31 06:17:19 EDT 2017


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1490951003 -7200
#      Fri Mar 31 11:03:23 2017 +0200
# Node ID d87f911de0d81391cd17e080a42050e91d45d2a7
# Parent  945e7d8bb4f7e8e5d7032b77d8cf45acd6d24349
# 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 d87f911de0d8
hook: use 'htype' in 'runhooks'

Same rational as for '_pythonhook', 'htype' is more accurate and less error
prone. We just fixed an error from the 'name'/'hname' confusion and this should
prevent them in the future.

diff --git a/mercurial/hook.py b/mercurial/hook.py
--- a/mercurial/hook.py
+++ b/mercurial/hook.py
@@ -201,7 +201,7 @@ def hook(ui, repo, name, throw=False, **
         r = res[hname][0] or r
     return r
 
-def runhooks(ui, repo, name, hooks, throw=False, **args):
+def runhooks(ui, repo, htype, hooks, throw=False, **args):
     res = {}
     oldstdout = -1
 
@@ -229,7 +229,8 @@ def runhooks(ui, repo, name, hooks, thro
                 r = 1
                 raised = False
             elif callable(cmd):
-                r, raised = _pythonhook(ui, repo, name, hname, cmd, args, throw)
+                r, raised = _pythonhook(ui, repo, htype, hname, cmd, args,
+                                        throw)
             elif cmd.startswith('python:'):
                 if cmd.count(':') >= 2:
                     path, cmd = cmd[7:].rsplit(':', 1)
@@ -244,7 +245,7 @@ def runhooks(ui, repo, name, hooks, thro
                     hookfn = getattr(mod, cmd)
                 else:
                     hookfn = cmd[7:].strip()
-                r, raised = _pythonhook(ui, repo, name, hname, hookfn, args,
+                r, raised = _pythonhook(ui, repo, htype, hname, hookfn, args,
                                         throw)
             else:
                 r = _exthook(ui, repo, hname, cmd, args, throw)


More information about the Mercurial-devel mailing list