comparison mercurial/hook.py @ 44911:fd3b94f1712d

merge with stable
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 26 May 2020 08:07:24 -0700
parents 09da5cf44772 50416d3d4b65
children b3e8d8e4a40d
comparison
equal deleted inserted replaced
44910:708ad5cf5e5a 44911:fd3b94f1712d
208 # Be careful in this section, propagating the real commands from untrusted 208 # Be careful in this section, propagating the real commands from untrusted
209 # sources would create a security vulnerability, make sure anything altered 209 # sources would create a security vulnerability, make sure anything altered
210 # in that section uses "_fromuntrusted" as its command. 210 # in that section uses "_fromuntrusted" as its command.
211 untrustedhooks = _hookitems(ui, _untrusted=True) 211 untrustedhooks = _hookitems(ui, _untrusted=True)
212 for name, value in untrustedhooks.items(): 212 for name, value in untrustedhooks.items():
213 trustedvalue = hooks.get(name, (None, None, name, _fromuntrusted)) 213 trustedvalue = hooks.get(name, ((), (), name, _fromuntrusted))
214 if value != trustedvalue: 214 if value != trustedvalue:
215 (lp, lo, lk, lv) = trustedvalue 215 (lp, lo, lk, lv) = trustedvalue
216 hooks[name] = (lp, lo, lk, _fromuntrusted) 216 hooks[name] = (lp, lo, lk, _fromuntrusted)
217 # (end of the security sensitive section) 217 # (end of the security sensitive section)
218 return [(k, v) for p, o, k, v in sorted(hooks.values())] 218 return [(k, v) for p, o, k, v in sorted(hooks.values())]
224 for name, cmd in ui.configitems(b'hooks', untrusted=_untrusted): 224 for name, cmd in ui.configitems(b'hooks', untrusted=_untrusted):
225 if name.startswith(b'priority.') or name.startswith(b'tonative.'): 225 if name.startswith(b'priority.') or name.startswith(b'tonative.'):
226 continue 226 continue
227 227
228 priority = ui.configint(b'hooks', b'priority.%s' % name, 0) 228 priority = ui.configint(b'hooks', b'priority.%s' % name, 0)
229 hooks[name] = (-priority, len(hooks), name, cmd) 229 hooks[name] = ((-priority,), (len(hooks),), name, cmd)
230 return hooks 230 return hooks
231 231
232 232
233 _redirect = False 233 _redirect = False
234 234