def _hookitems(ui, _untrusted=False):
    """return all hooks items ready to be sorted"""
    hooks = {}
    for name, cmd in ui.configitems(b'hooks', untrusted=_untrusted):
        if name.startswith(b'priority.') or name.startswith(b'tonative.'):
            continue
        priority = ui.configint(b'hooks', b'priority.%s' % name, 0)
        hooks[name] = -priority, len(hooks), name, cmd
    return hooks
