views:

51

answers:

1

I've already got my subversion repository set up to require comments of a minimum length to accept a commit. However, I'd like to start tagging those comments with information from our bug tracking system when committed. I've already got the scripts set up to pull data from the bug tracker and just need a way to get that info into the subversion commit comments.

How can append to the existing comment in subversion automatically?

For reference, the subversion repository is hosted on a linux server with Ubuntu 9 something installed and I have complete root access to the machine.

+2  A: 

This thread has some reasonable advice. Basically, you can svn propset --revprop svn:log -r REV in your prepost-commit hook.

Update: propset takes the revision number, so I don't understand how to do this in pre-commit. You'd need to convert TXN (the arg to pre-commit) to REV. And you may not be able to get at the log message using propset since it hasn't actually been committed.

Dave Bacher
This almost gets me there, but the problem is that I wan to _append_ to the existing log. I've tried a simple `svn propget svn:log` - which returns nothing. I can use `svn log` but my bash parsing skils are woefully inadequate. Is there a simple way to get just the message from the commit?
Paul Alexander
You can use `svnlook log -r REV REPOS`. The pre-commit template has an example of how to get the log in a pre-commit transaction. Also (see my edit) `svn:log` is a revision property.
Dave Bacher
Unfortunately, propset requires a working directory - which the post-commit script does not have. Still working on this but no solution yet.
Paul Alexander
I think propget and propset for revision properties just need a target repository, not a working directory. Since you're running on the server and you know the path, you can use `svn propset --revprop svn:log -r REV file:///path/to/repo`. This form works for me when testing on the command line.
Dave Bacher