Mercurial > hg-stable
comparison mercurial/hook.py @ 8209:a1a5a57efe90
replace util.sort with sorted built-in
This is marginally faster for small and moderately-sized lists
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sun, 26 Apr 2009 16:50:44 -0500 |
parents | cce63ef1045b |
children | 46293a0c7e9f |
comparison
equal
deleted
inserted
replaced
8208:32a2a1e244f1 | 8209:a1a5a57efe90 |
---|---|
102 # temporarily redirect stdout to stderr | 102 # temporarily redirect stdout to stderr |
103 oldstdout = os.dup(sys.__stdout__.fileno()) | 103 oldstdout = os.dup(sys.__stdout__.fileno()) |
104 os.dup2(sys.__stderr__.fileno(), sys.__stdout__.fileno()) | 104 os.dup2(sys.__stderr__.fileno(), sys.__stdout__.fileno()) |
105 | 105 |
106 try: | 106 try: |
107 for hname, cmd in util.sort(ui.configitems('hooks')): | 107 for hname, cmd in ui.configitems('hooks'): |
108 if hname.split('.')[0] != name or not cmd: | 108 if hname.split('.')[0] != name or not cmd: |
109 continue | 109 continue |
110 if callable(cmd): | 110 if callable(cmd): |
111 r = _pythonhook(ui, repo, name, hname, cmd, args, throw) or r | 111 r = _pythonhook(ui, repo, name, hname, cmd, args, throw) or r |
112 elif cmd.startswith('python:'): | 112 elif cmd.startswith('python:'): |