mercurial/hook.py
changeset 6762 f67d1468ac50
parent 6266 9f76df0edb7d
child 7280 810ca383da9c
--- a/mercurial/hook.py	Fri Jun 27 14:53:30 2008 -0500
+++ b/mercurial/hook.py	Fri Jun 27 18:28:45 2008 -0500
@@ -96,10 +96,9 @@
         oldstdout = os.dup(sys.__stdout__.fileno())
         os.dup2(sys.__stderr__.fileno(), sys.__stdout__.fileno())
 
-    hooks = [(hname, cmd) for hname, cmd in ui.configitems("hooks")
-             if hname.split(".", 1)[0] == name and cmd]
-    hooks.sort()
-    for hname, cmd in hooks:
+    for hname, cmd in util.sort(ui.configitems('hooks')):
+        if hname.split('.')[0] != name or not cmd:
+            continue
         if callable(cmd):
             r = _pythonhook(ui, repo, name, hname, cmd, args, throw) or r
         elif cmd.startswith('python:'):