Need help in Setting trac-post-commit-hook in subversion

14 views
Skip to first unread message

ken

unread,
Jan 24, 2007, 12:53:37 PM1/24/07
to Trac Users
I am trying to setup trac-post-commit-hook in subversion. After I
execute 'svn commit -m 'Fixes #134' ', I don't see the ticket gets
updated (set the state to 'closed').

I check the path of 'svnlook' ,'python', 'trac-post-commit-hook', they
all look correct:
Can you please tell me what am I missing?

Here is my post-commit file in my subversion repository hook directory.
REPOS="$1"
REV="$2"
LOG=`/usr/local/bin/svnlook log -r $REV $REPOS`
AUTHOR=`/usr/local/bin/svnlook author -r $REV $REPOS`
TRAC_ENV='/srv/svn/tracenv/project/'
TRAC_URL='http://localhost://tracprojects/project/'

/usr/bin/python
/srv/svn/repositories/project/hooks/trac-post-commit-hook \
-p "$TRAC_ENV" \
-r "$REV" \
-u "$AUTHOR" \
-m "$LOG" \
-s "$TRAC_URL"

Emmanuel Blot

unread,
Jan 24, 2007, 5:55:44 PM1/24/07
to trac-...@googlegroups.com
Try to dump the error output to a log file, and examine the content of
this log file after a commit operation.

Simply add a stderr redirection:

/usr/bin/python
/srv/svn/repositories/project/hooks/trac-post-commit-hook \
-p "$TRAC_ENV" \
-r "$REV" \
-u "$AUTHOR" \
-m "$LOG" \

-s "$TRAC_URL" 2>> /tmp/trac.log

(be sure that /tmp is writable for any user)

Cheers,
Manu

On 1/24/07, ken <ken.c...@gmail.com> wrote:
>
> I am trying to setup trac-post-commit-hook in subversion. After I
> execute 'svn commit -m 'Fixes #134' ', I don't see the ticket gets
> updated (set the state to 'closed').

--
Manu

ken

unread,
Jan 25, 2007, 1:20:59 AM1/25/07
to Trac Users
Thank you.

i add this in post-commit, and i make sure /tmp is writable by
everyone.


/usr/bin/python
/srv/svn/repositories/project/hooks/trac-post-commit-hook \
-p "$TRAC_ENV" \
-r "$REV" \
-u "$AUTHOR" \
-m "$LOG" \
-s "$TRAC_URL" 2>> /tmp/trac.log


drwxrwxrwt 45 root root 4096 Jan 25 00:14 tmp/

But it does not create any 'trac.log' after i did a 'svn commit' again.

Thank you for any pointers.

On Jan 24, 4:55 pm, "Emmanuel Blot" <manu.b...@gmail.com> wrote:
> Try to dump the error output to a log file, and examine the content of
> this log file after a commit operation.
>
> Simply add a stderr redirection:
>
> /usr/bin/python
> /srv/svn/repositories/project/hooks/trac-post-commit-hook \
> -p "$TRAC_ENV" \
> -r "$REV" \
> -u "$AUTHOR" \
> -m "$LOG" \
> -s "$TRAC_URL" 2>> /tmp/trac.log
>
> (be sure that /tmp is writable for any user)
>
> Cheers,
> Manu
>

Emmanuel Blot

unread,
Jan 25, 2007, 9:05:52 AM1/25/07
to trac-...@googlegroups.com
> But it does not create any 'trac.log' after i did a 'svn commit' again.
>
> Thank you for any pointers.

Is your post-commit file (in the svnrepos/hooks directory) executable
bit set for the 'user' that runs your Subversion engine (Apache or
svn) ?

Cheers,
Manu

David Herman

unread,
Jan 25, 2007, 9:42:31 AM1/25/07
to trac-...@googlegroups.com
Are you calling the hook from a shell script named post-commit or are
you calling the one that came with trac? You need to call it from a
shell so it can be passed in the correct variables. We got the same
behavior as you when trying to call it directly.

Cheers,
Manu

--
This message has been scanned for viruses and dangerous content by the
eDiets MailScanner, and is believed to be clean.

ken

unread,
Jan 25, 2007, 11:51:50 AM1/25/07
to Trac Users
Thanks for all the help. I am able to get it to work.
Reply all
Reply to author
Forward
0 new messages