2

I have a Trac environment with SVN repository linked.

I am trying to setup SVN post commit hook to automatically update Trac tickets and add references etc.

In /var/lib/svn/repository/hooks/post-commit I have

REPOS="$1" REV="$2"

/usr/bin/python /var/lib/trac/custom-trac-post-commit.py -p "/var/lib/trac/Project" -r "$REV"

Could you guys please assist how to debug it? I get no errors or anything.

If I use instead:

REPOS="$1" REV="$2"

/usr/bin/trac-admin /var/lib/trac/Project changeset added "$1" "$2"

It is sort of working, commits show in Trac timeline. But I need to be able to update tickets as well.

You can review custom-trac-post-commit.py here http://paste.ubuntu.com/9675899/

Thanks!

  • On line #128 change the log level to "true", after that, do a commit and post the output of the logfile that is in /var/trac/commithook.log – radriaanse Jan 05 '15 at 10:48
  • @remyseroos - I tried it already. Log has "Begin Log" inside and file is not touched for a very long time. This leads me to conclusion that for some reason python script is not executed. Also, nothing happens when I execute with root: /usr/bin/python /var/lib/trac/custom-trac-post-commit.py -p /var/lib/trac/Project -r 39041 – Radoslav Stefanov Jan 05 '15 at 10:56
  • I fixed some syntax errors in the Python script, it should now at least run. Check the new version out over here; https://gist.githubusercontent.com/radriaanse/b963b76a8a31cd1ee0ef/raw/19b5547dc744d1848a862d76ba569f0dd7b72c2a/gistfile1.py – radriaanse Jan 05 '15 at 12:22
  • Same thing happens (nothing). Even if I execute it manually. It just creates empty log file with "Begin Log". No changeset is added to Trac timeline and no ticket is updated. – Radoslav Stefanov Jan 05 '15 at 14:02
  • Can you check your python version on the system where you try to run the program? – radriaanse Jan 05 '15 at 15:26
  • @remyseroos it is 2.7.6. However the hook was working for a long time. It stopped working recently, nothing has changed on the server. Thats why I would like to learn how to debug it. – Radoslav Stefanov Jan 05 '15 at 16:30

0 Answers0