How to setup a custom hook ?
Nicolas Pinault
nicolasp at aaton.com
Tue May 17 08:04:52 UTC 2016
Le 12/05/2016 à 18:23, Konstantin Veretennicov a écrit :
>
>
> On May 12, 2016 10:36 AM, "Nicolas Pinault" <nicolasp at aaton.com
> <mailto:nicolasp at aaton.com>> wrote:
> >
> >
> >> In Admin/Settings/Hooks, I tried the following configurations
> without success :
> >> - changegroup.my_script python c:/Kallithea/Bin/my_script.py
> >
> > This syntax is the correct one and works perfectly.
> > My error was that the cwd used is not the Bin directory of Kallithea
> but the repo directory. That made my script not work.
>
> Glad you figured it out and thanks for sharing.
>
> Was the mistake difficult to diagnose? Do you think Kallithea could
> make it easier to debug this kind of issues?
>
I think documentation could be improved.
Please note that I use Kallithea with Mercurial.
For my tests, I created a small Python script which write a simple log
in a file. I though this file would be located in Kallithea binary
directory as its path is "./log.txt". In fact it was located in
repository directory. It took me some time to realize it.
Maybe the documentation should notice it.
I used the following link for documentation :
https://pythonhosted.org/Kallithea/setup.html "Hook management" section.
The "<|name>.<hook_type>|" assertion is either false or misleading. I
think it should be replaced with "<hook_type>.<name>" as the first part
of the hook description is the Mercurial hook type.
Also specifying the following may be helpful :
- The "<name>" part can be whatever we want (are there character
restrictions ?) and is just a description (a reminder).
- "<hook_type>.<name>" must be unique
- "<hook_type> must be a Mercurial hook type. These can be found here :
https://selenic.com/hg/help/hgrc
- Mercurial hook "arguments" like "$HG_NODE" are set in process
environment variables by Kallithea before calling the hook.
- Kallithea sets an environment variable called "$KALLITHEA_EXTRAS"
before calling the hook. This is especially useful to get the repository
name in the hook process.
I have seen no trace in the console output noticing the execution of the
hook. There might be a log somewhere but I have not found any log file
anywhere.
Example hook descriptions might me helpful.
Hope this helps.
Regards,
Nicolas
>
> --
> Regards,
> Konstantin
>
> >
> >
> > Nicolas
> >
> > _______________________________________________
> > kallithea-general mailing list
> > kallithea-general at sfconservancy.org
> <mailto:kallithea-general at sfconservancy.org>
> > http://lists.sfconservancy.org/mailman/listinfo/kallithea-general
>
--
*Nicolas PINAULT
R&D electronics engineer
*** nicolas at aaton.com <mailto:nicolas at aaton.com>
*AATON-Digital*
38000 Grenoble - France
Tel +33 4 7642 9550
http://www.aaton.com
http://www.transvideo.eu
French Technologies for Film and Digital Cinematography
Follow us on Twitter
@Aaton_Digital
@Transvideo_HD
Like us on Facebook
https://www.facebook.com/AatonDigital
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sfconservancy.org/pipermail/kallithea-general/attachments/20160517/4221c0ec/attachment.html>
More information about the kallithea-general
mailing list