mercurial/hook.py
branchstable
changeset 44782 50416d3d4b65
parent 44654 3cbbfd0bfc17
child 44911 fd3b94f1712d
equal deleted inserted replaced
44781:f445a4f7e8a7 44782:50416d3d4b65
   204     # Be careful in this section, propagating the real commands from untrusted
   204     # Be careful in this section, propagating the real commands from untrusted
   205     # sources would create a security vulnerability, make sure anything altered
   205     # sources would create a security vulnerability, make sure anything altered
   206     # in that section uses "_fromuntrusted" as its command.
   206     # in that section uses "_fromuntrusted" as its command.
   207     untrustedhooks = _hookitems(ui, _untrusted=True)
   207     untrustedhooks = _hookitems(ui, _untrusted=True)
   208     for name, value in untrustedhooks.items():
   208     for name, value in untrustedhooks.items():
   209         trustedvalue = hooks.get(name, (None, None, name, _fromuntrusted))
   209         trustedvalue = hooks.get(name, ((), (), name, _fromuntrusted))
   210         if value != trustedvalue:
   210         if value != trustedvalue:
   211             (lp, lo, lk, lv) = trustedvalue
   211             (lp, lo, lk, lv) = trustedvalue
   212             hooks[name] = (lp, lo, lk, _fromuntrusted)
   212             hooks[name] = (lp, lo, lk, _fromuntrusted)
   213     # (end of the security sensitive section)
   213     # (end of the security sensitive section)
   214     return [(k, v) for p, o, k, v in sorted(hooks.values())]
   214     return [(k, v) for p, o, k, v in sorted(hooks.values())]
   220     for name, cmd in ui.configitems(b'hooks', untrusted=_untrusted):
   220     for name, cmd in ui.configitems(b'hooks', untrusted=_untrusted):
   221         if name.startswith(b'priority.') or name.startswith(b'tonative.'):
   221         if name.startswith(b'priority.') or name.startswith(b'tonative.'):
   222             continue
   222             continue
   223 
   223 
   224         priority = ui.configint(b'hooks', b'priority.%s' % name, 0)
   224         priority = ui.configint(b'hooks', b'priority.%s' % name, 0)
   225         hooks[name] = (-priority, len(hooks), name, cmd)
   225         hooks[name] = ((-priority,), (len(hooks),), name, cmd)
   226     return hooks
   226     return hooks
   227 
   227 
   228 
   228 
   229 _redirect = False
   229 _redirect = False
   230 
   230