Mercurial > public > mercurial-scm > hg-stable
diff mercurial/hook.py @ 6762:f67d1468ac50
util: add sort helper
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 27 Jun 2008 18:28:45 -0500 |
parents | 9f76df0edb7d |
children | 810ca383da9c |
line wrap: on
line diff
--- 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:'):