hook: use 'htype' in 'runhooks'
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Fri, 31 Mar 2017 11:03:23 +0200
changeset 31744 5678496659e9
parent 31743 f610c3220eec
child 31745 33504b54863e
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.
mercurial/hook.py
--- a/mercurial/hook.py	Fri Mar 31 11:02:05 2017 +0200
+++ b/mercurial/hook.py	Fri Mar 31 11:03:23 2017 +0200
@@ -201,7 +201,7 @@
         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 @@
                 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 @@
                     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)