mercurial/hook.py
changeset 44852 fd3b94f1712d
parent 44835 09da5cf44772
parent 44828 50416d3d4b65
child 45737 b3e8d8e4a40d
equal deleted inserted replaced
44851:708ad5cf5e5a 44852: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