This forum is no longer active. Please post your questions to our new community site

Forums Trac

pre and post commit hook scripts

Subscribe to pre and post commit hook scripts 6 post(s), 4 voice(s)

Avatar slueder 6 post(s)

I cannot figure out how to setup pre and post commit hook scripts for updating trac records when an SVN commit is made. it is getting increasingly complex with every page I read. Has anyone in the bitnami team set this up using the windows native installer that can help me out with some step by step instructions for writing the .bat files?

Avatar Beltrán Rueda Administrator 3,714 post(s)

We are system integrations and we are not Trac experts.I’m sure you will find more help in the official trac forums

Avatar dugokontov 1 post

Here is what i did to make post commit hook scripts work on windows:
1. in svn directory find hooks folder (usually documents/user/BitNami Trac Stack repository/hooks)
2. in this folder copy post-commit.bat script. Mine .bat script only has one line:

call “%~dp0\trac-post-commit-hook.cmd” %1 %2

3. install python (if not already). I found it in C:\Program Files\BitNami Trac Stack\python\python-2.5.4.msi
4. install python win 32 (if not already) from
5. copy post commit scripts in hooks folder

trac-post-commit-hook.cmd should look like this:
SET TRAC_ENV=C:\Documents and Settings\user\BitNami Trac Stack projects\projectname


Python “%~dp0\trac-post-commit-hook” -p “TRAC_ENV” -r “REV

in trac-post-commit-hook file you can add some new verbs for closing ticket…

Avatar Beltrán Rueda Administrator 3,714 post(s)

Thanks for posting this. I will be very usefull for other BitNami users. We will consider include this fix for next builds.

Avatar echoecho 3 post(s)

To clarify for the BitNami admins: the latest versions of Trac expect you to run this post-commit hook to inform Trac when a commit happens. The legacy method of repository syncing for every web request is still around, but this massive polling is inefficient for obvious reasons (even on my well-overbuilt server, it adds 1/2 to 2 seconds for every page load).

The post-commit hook is the right way to do things, and I would definitely like to see future BitNami Trac Stack installs download with this pre-configured to use the bundled Python :)

For those of you who cannot or don’t want to get the hook configured correctly, add this to your Trac/Project-Name/conf/trac.ini:
repository_sync_per_request = Trac-Repos-Name

My Trac project is called Project and my SVN repos is called new, so I add this to my Trac/Project/conf/trac.ini:
repository_sync_per_request = new

Avatar Beltrán Rueda Administrator 3,714 post(s)

Thanks for your suggestions. We will investigate this configuration.

Forums Trac