mercurial/hook.py
changeset 31746 0fa30fbccc34
parent 31745 33504b54863e
child 31747 aff7b32b3c05
--- a/mercurial/hook.py	Fri Mar 31 11:06:42 2017 +0200
+++ b/mercurial/hook.py	Fri Mar 31 11:08:11 2017 +0200
@@ -114,7 +114,7 @@
         ui.warn(_('warning: %s hook failed\n') % hname)
     return r, False
 
-def _exthook(ui, repo, name, cmd, args, throw):
+def _exthook(ui, repo, htype, name, cmd, args, throw):
     ui.note(_("running hook %s: %s\n") % (name, cmd))
 
     starttime = util.timer()
@@ -126,6 +126,7 @@
         repo.dirstate.write(tr)
         if tr and tr.writepending():
             env['HG_PENDING'] = repo.root
+    env['HG_HOOKTYPE'] = htype
 
     for k, v in args.iteritems():
         if callable(v):
@@ -248,7 +249,7 @@
                 r, raised = _pythonhook(ui, repo, htype, hname, hookfn, args,
                                         throw)
             else:
-                r = _exthook(ui, repo, hname, cmd, args, throw)
+                r = _exthook(ui, repo, htype, hname, cmd, args, throw)
                 raised = False
 
             res[hname] = r, raised