Mercurial > kallithea
changeset 8845:d8e65780dbe9
hooks: clarify in UI and documentation how the hook control essentially is Mercurial only
The Git hook model doesn't directly allow multiple hooks of the same kind.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Mon, 11 Jan 2021 14:25:52 +0100 |
parents | 3b5657fba7f3 |
children | 20e850093f1c |
files | docs/setup.rst docs/upgrade.rst docs/usage/troubleshooting.rst kallithea/templates/admin/settings/settings_hooks.html kallithea/templates/admin/settings/settings_vcs.html |
diffstat | 5 files changed, 32 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/docs/setup.rst Mon Jan 11 14:25:52 2021 +0100 +++ b/docs/setup.rst Mon Jan 11 14:25:52 2021 +0100 @@ -338,15 +338,19 @@ Hook management --------------- -Hooks can be managed in similar way to that used in ``.hgrc`` files. +Custom Mercurial hooks can be managed in a similar way to that used in ``.hgrc`` files. To manage hooks, choose *Admin > Settings > Hooks*. -The built-in hooks cannot be modified, though they can be enabled or disabled in the *VCS* section. - To add another custom hook simply fill in the first textbox with ``<name>.<hook_type>`` and the second with the hook path. Example hooks can be found in ``kallithea.lib.hooks``. +Kallithea will also use some hooks internally. They cannot be modified, but +some of them can be enabled or disabled in the *VCS* section. + +Kallithea has no support for custom Git hooks. Kallithea will install and use +Git hooks internally, and they might collide with manually installed hooks. + Changing default encoding -------------------------
--- a/docs/upgrade.rst Mon Jan 11 14:25:52 2021 +0100 +++ b/docs/upgrade.rst Mon Jan 11 14:25:52 2021 +0100 @@ -225,8 +225,8 @@ upgrade. -10. Update Git repository hooks -------------------------------- +10. Reinstall internal Git repository hooks +------------------------------------------- It is possible that an upgrade involves changes to the Git hooks installed by Kallithea. As these hooks are created inside the repositories on the server
--- a/docs/usage/troubleshooting.rst Mon Jan 11 14:25:52 2021 +0100 +++ b/docs/usage/troubleshooting.rst Mon Jan 11 14:25:52 2021 +0100 @@ -43,12 +43,18 @@ | :Q: **How can I use hooks in Kallithea?** -:A: It's easy if they are Python hooks: just use advanced link in - hooks section in Admin panel, that works only for Mercurial. If - you want to use Git hooks, just install th proper one in the repository, - e.g., create a file `/gitrepo/hooks/pre-receive`. You can also use - Kallithea-extensions to connect to callback hooks, for both Git - and Mercurial. +:A: If using Mercurial, use *Admin > Settings > Hooks* to install + global hooks. Inside the hooks, you can use the current working directory to + control different behaviour for different repositories. + + If using Git, install the hooks manually in each repository, for example by + creating a file ``gitrepo/hooks/pre-receive``. + Note that Kallithea uses the ``post-receive`` hook internally. + Kallithea will not work properly if another post-receive hook is installed instead. + You might also accidentally overwrite your own post-receive hook with the Kallithea hook. + + You can also use Kallithea-extensions to connect to callback hooks, + for both Git and Mercurial. |
--- a/kallithea/templates/admin/settings/settings_hooks.html Mon Jan 11 14:25:52 2021 +0100 +++ b/kallithea/templates/admin/settings/settings_hooks.html Mon Jan 11 14:25:52 2021 +0100 @@ -2,7 +2,7 @@ ${h.form(url('admin_settings_hooks'), method='post')} <div class="form"> <div class="form-group"> - <h4>${_('Custom Hooks')}</h4> + <h4>${_('Custom Global Mercurial Hooks')}</h4> <span class="help-block">${_('Hooks can be used to trigger actions on certain events such as push / pull. They can trigger Python functions or external applications.')}</span> %for hook in c.custom_hooks: <div class="form-group form-inline" id="${'id%s' % hook.ui_id }"> @@ -37,6 +37,15 @@ </div> </div> ${h.end_form()} + +<div class="form"> + <div class="form-group"> + <h4>${_('Git Hooks')}</h4> + <span class="help-block">${h.HTML(_('Kallithea has no support for custom Git hooks. Kallithea will use Git post-receive hooks internally. Installation of these hooks is managed in %s.')) % (h.literal('''<a href="%s">%s</a>''') % (h.url('admin_settings_mapping'), _('Remap and Rescan')))}</span> +</div> + +% else: + <h4>${_('Custom Hooks are not enabled')}</h4> % endif <script>
--- a/kallithea/templates/admin/settings/settings_vcs.html Mon Jan 11 14:25:52 2021 +0100 +++ b/kallithea/templates/admin/settings/settings_vcs.html Mon Jan 11 14:25:52 2021 +0100 @@ -1,7 +1,7 @@ ${h.form(url('admin_settings'), method='post')} <div class="form"> <div class="form-group"> - <label class="control-label">${_('Hooks')}:</label> + <label class="control-label">${_('Mercurial Push Hooks')}:</label> <div> <div class="checkbox"> <label>