post-commit and pre-commit hooks in git repositories are not fired when commiting from web

244 views
Skip to first unread message

akat...@gmail.com

unread,
May 10, 2013, 11:22:51 PM5/10/13
to rhod...@googlegroups.com
Hi, I need some help.
I setup "post_update" hooks in my Rhodecode git repositories and works fine, they fire with every push.
I also add pre-commit and post-commit hooks to be fired when somebody edit and commit a file from web gui, but this hooks doesn't work.
What could be the problem?

regards
Christian

Marcin Kuzminski

unread,
May 11, 2013, 5:45:49 AM5/11/13
to rhod...@googlegroups.com
Hi,

So the issue here is that web-based commits are done via our in-memory commits function in RhodeCode. It's based on dulwich which doesn't support hooks :(
We did one work-around to handle our internal hooks so when you edit the, rhodecode hooks are called, that invalidates caches, updates push logs etc.

If you want to do custom stuff on hooks, and have it consistent for everything in RhodeCode i would recommend putting it to rcextensions, the hooks functions defined in there are always called.

Marcin Kuzminski


--
You received this message because you are subscribed to the Google Groups "rhodecode" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rhodecode+...@googlegroups.com.
To post to this group, send email to rhod...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

akat...@gmail.com

unread,
May 11, 2013, 8:44:49 AM5/11/13
to rhod...@googlegroups.com
Which hook in rcextensions/__init__.py is fired when doing web-based commits? I only found "POST PUSH HOOK" and "POST PULL HOOK"

regards
Christian

Marcin Kuzminski

unread,
May 11, 2013, 9:58:51 AM5/11/13
to rhod...@googlegroups.com
it's post push hook

Marcin Kuzminski

akat...@gmail.com

unread,
May 11, 2013, 7:42:23 PM5/11/13
to rhod...@googlegroups.com
Hi, I don't know what I'm doing wrong (I have no experience with python), but I can't make __init__.py POST_PUSH to work.

I need to run a bash script from __init__.py POST_PUSH, my code is:

def _pushhook(*args, **kwargs):

    import os
    os.system("sh /rhode/log/log.sh")

    return 0
PUSH_HOOK = _pushhook

I also try:

def _pushhook(*args, **kwargs):

    subprocess.call(["sh /rhode/log/log.sh"])

    return 0
PUSH_HOOK = _pushhook

But it doesn't work too.

log.sh is a simple script that log a comment to a file.

What I'm doing wrong?.
Thank you in advance. Regards.
Christian

akat...@gmail.com

unread,
May 12, 2013, 12:12:06 AM5/12/13
to rhod...@googlegroups.com
Forget it, it was a permisions problem. Sorry.


On Saturday, May 11, 2013 10:58:51 AM UTC-3, marcin wrote:
Reply all
Reply to author
Forward
0 new messages