Mercurial > hg
comparison mercurial/hook.py @ 31745:33504b54863e
hook: use 'htype' in 'hook'
Same rational as for 'runhooks', we fix the naming in another function.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Fri, 31 Mar 2017 11:06:42 +0200 |
parents | 5678496659e9 |
children | 0fa30fbccc34 |
comparison
equal
deleted
inserted
replaced
31744:5678496659e9 | 31745:33504b54863e |
---|---|
184 _redirect = False | 184 _redirect = False |
185 def redirect(state): | 185 def redirect(state): |
186 global _redirect | 186 global _redirect |
187 _redirect = state | 187 _redirect = state |
188 | 188 |
189 def hook(ui, repo, name, throw=False, **args): | 189 def hook(ui, repo, htype, throw=False, **args): |
190 if not ui.callhooks: | 190 if not ui.callhooks: |
191 return False | 191 return False |
192 | 192 |
193 hooks = [] | 193 hooks = [] |
194 for hname, cmd in _allhooks(ui): | 194 for hname, cmd in _allhooks(ui): |
195 if hname.split('.')[0] == name and cmd: | 195 if hname.split('.')[0] == htype and cmd: |
196 hooks.append((hname, cmd)) | 196 hooks.append((hname, cmd)) |
197 | 197 |
198 res = runhooks(ui, repo, name, hooks, throw=throw, **args) | 198 res = runhooks(ui, repo, htype, hooks, throw=throw, **args) |
199 r = False | 199 r = False |
200 for hname, cmd in hooks: | 200 for hname, cmd in hooks: |
201 r = res[hname][0] or r | 201 r = res[hname][0] or r |
202 return r | 202 return r |
203 | 203 |