Changeset - d8e65780dbe9
[Not reviewed]
default
0 5 0
Mads Kiilerich (mads) - 5 years ago 2021-01-11 14:25:52
mads@kiilerich.com
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.
5 files changed with 32 insertions and 13 deletions:
0 comments (0 inline, 0 general)
docs/setup.rst
Show inline comments
 
@@ -335,21 +335,25 @@ Refer to the `Python regular expression 
 
the supported syntax in ``issue_pat``, ``issue_server_link`` and ``issue_sub``.
 

	
 

	
 
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
 
-------------------------
 

	
 
By default, Kallithea uses UTF-8 encoding.
 
This is configurable as ``default_encoding`` in the .ini file.
docs/upgrade.rst
Show inline comments
 
@@ -222,14 +222,14 @@ clear out your log file so that new erro
 

	
 
.. note::
 
    If you're using Celery, make sure you restart all instances of it after
 
    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
 
filesystem, they are not updated automatically when upgrading Kallithea itself.
 

	
 
To update the hooks of your Git repositories, run::
docs/usage/troubleshooting.rst
Show inline comments
 
@@ -40,18 +40,24 @@ Troubleshooting
 
:A: Make sure you're using a WSGI http server that can handle chunked encoding
 
    such as ``waitress`` or ``gunicorn``.
 

	
 
|
 

	
 
: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.
 

	
 
|
 

	
 
:Q: **Kallithea is slow for me, how can I make it faster?**
 
:A: See the :ref:`performance` section.
 

	
kallithea/templates/admin/settings/settings_hooks.html
Show inline comments
 
% if c.visual.allow_custom_hooks_settings:
 
${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 }">
 
                <% input_id = hook.ui_key.replace('.', '_') %>
 
                    <label class="control-label" for="${input_id}" title="${hook.ui_key}">${hook.ui_key}</label>
 
                    <div>
 
@@ -34,12 +34,21 @@ ${h.form(url('admin_settings_hooks'), me
 
                ${h.submit('save',_('Save'),class_="btn btn-default")}
 
            </div>
 
        </div>
 
      </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>
 
'use strict';
 
function delete_hook(hook_id, field_id) {
 
    var sUrl = ${h.js(h.url('admin_settings_hooks_delete'))};
kallithea/templates/admin/settings/settings_vcs.html
Show inline comments
 
${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>
 
                            ${h.checkbox('hooks_changegroup_kallithea_repo_size','True')}
 
                            ${_('Show repository size after push')}
 
                        </label>
0 comments (0 inline, 0 general)