Updating the Status of a Trac ticket via a SVN commit
One of the really nice things about the SVN/Trac combo is that when you commit changes to SVN, you can have the changeset update the status of a Trac ticket.
So, say the changes you have been working on, have tested, and are now committing back to SVN fix a specific ticket within Trac, and once you've made your commit, you would then log into Trac and close the ticket there.
You could also do this via the superb Mylyn integration if you're using Eclipse - which you should be :)
Well, how about updating the actual status when you do your commit? One action to rule them all, so to speak.
Well, this is possible, and here's how to do it.
The main reason for posting this, is that I've recently upgraded our Trac environment from 0.10 to 0.11 and I noticed the trac-post-commit was now broken.
The following is for Linux, so you'll need to Google for Windows.
Grab the trac-post-commit script
You need to pull the latest working version of the script from the Trac SVN repository.
Next rename the file you've just exported by sticking a ".py" on the end - it's a Python script.
Next make sure your post-commit script file is named appropriately (post-commit funnily enough) and make sure that execute permissions are set on the file. You know, chmod ugo+x post-commit
Edit the post-commit script
Next, edit your post-commit file and add the following line - this is the reason ours was broken.
Now add the following line, and this is the one that calls the trac-post-commit script
Just to be on the safe side of everything, just Apache a restart.
Commit Your Change
Now, from within Eclipse, when you want to commit your changes, you can now put the following in your comments (and you are filling in comments aren't you?????!!!???"
command #1,#2
command #1 & #2
command #1 and #2
The following commands are supported:
- close
- closed
- closes
- fix
- fixed
- fixes
The above will close the specified ticket number, in addition to adding the message you have specified.
Also, you can use the following commands:
- references
- refs
- addresses
- re
- see
The ticket numbers specific here are left as is, but the contents of the commit messages are added to their notes.
A quick example would be something like:
This commit message will close tickets 100 and 102, and add the commit message to ticket 85.



This is going to be one of my next video sessions.
thank you for this post.
All is right with the displaying of svn commit messages in trac, but I have a problem with the comments that are written on more than 2 lines.
For example, in eclipse, if the comment is 'a comment in eclipse', then in trac, you see 'a comment in eclipse', but if the comment is :
'a line in eclipse
a second line in eclipe'
then, in trac, le messages is :
'a line in eclipse a second line in eclipe'
all is on one line.
Do you have the same problem ?
if not, what to do in trac for displaying the carriage return that is in the svn commit message ?
thanks for your answer.
http://www.wowgold800.com
http://www.igwww.com
http://www.goldwowgold.com
http://www.wowgoldchina.com
http://www.igxee.com
http://www.mmorpg365.com
http://www.wowgoldwww.com
http://www.wowgoldabc.com