# HG changeset patch # User Mads Kiilerich # Date 1610371552 -3600 # Node ID d8e65780dbe9979f9f01d9ca39ccde3c6cc9c322 # Parent 3b5657fba7f387a6729051e62b9968184bd8b900 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. diff -r 3b5657fba7f3 -r d8e65780dbe9 docs/setup.rst --- 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 ``.`` 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 ------------------------- diff -r 3b5657fba7f3 -r d8e65780dbe9 docs/upgrade.rst --- 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 diff -r 3b5657fba7f3 -r d8e65780dbe9 docs/usage/troubleshooting.rst --- 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. | diff -r 3b5657fba7f3 -r d8e65780dbe9 kallithea/templates/admin/settings/settings_hooks.html --- 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')}
-

${_('Custom Hooks')}

+

${_('Custom Global Mercurial Hooks')}

${_('Hooks can be used to trigger actions on certain events such as push / pull. They can trigger Python functions or external applications.')} %for hook in c.custom_hooks:
@@ -37,6 +37,15 @@
${h.end_form()} + +
+
+

${_('Git Hooks')}

+ ${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('''%s''') % (h.url('admin_settings_mapping'), _('Remap and Rescan')))} +
+ +% else: +

${_('Custom Hooks are not enabled')}

% endif