##// END OF EJS Templates
hook: split config reading further...
Pierre-Yves David -
r28937:3112c5e1 default
parent child Browse files
Show More
@@ -162,12 +162,18 b' def _exthook(ui, repo, name, cmd, args, '
162 return r
162 return r
163
163
164 def _allhooks(ui):
164 def _allhooks(ui):
165 """return a list of (hook-id, cmd) pairs sorted by priority"""
166 hooks = _hookitems(ui)
167 return [(k, v) for p, o, k, v in sorted(hooks.values())]
168
169 def _hookitems(ui):
170 """return all hooks items ready to be sorted"""
165 hooks = {}
171 hooks = {}
166 for name, cmd in ui.configitems('hooks'):
172 for name, cmd in ui.configitems('hooks'):
167 if not name.startswith('priority'):
173 if not name.startswith('priority'):
168 priority = ui.configint('hooks', 'priority.%s' % name, 0)
174 priority = ui.configint('hooks', 'priority.%s' % name, 0)
169 hooks[name] = (-priority, len(hooks), name, cmd)
175 hooks[name] = (-priority, len(hooks), name, cmd)
170 return [(k, v) for p, o, k, v in sorted(hooks.values())]
176 return hooks
171
177
172 _redirect = False
178 _redirect = False
173 def redirect(state):
179 def redirect(state):
General Comments 0
You need to be logged in to leave comments. Login now