Changing Subversion Log Messages
06 05 08
You can’t easily edit a log message with Subversion after a commit. The Subversion FAQ entry on the topic explains that this is because “changes to revision properties (of which svn:log is one) cause the property’s previous value to be permanently discarded, and Subversion tries to prevent you from doing this accidentally.”
In an effort to make this process simpler, I wrote a short shell script to automate the process.
#!/bin/bash
REPOS_PATH="/`svn info | grep Root | cut -d ' ' -f 3 | cut -d '/' -f 4-`"
REVPROPHOOK="$REPOS_PATH/hooks/pre-revprop-change"
# check for required parameter count
if [ $# != 2 ]; then
echo "Usage: `basename $0` {revision} {new log message}"
exit
fi
# copy pre-revprop-change hook into place and make executable
sudo cp $REVPROPHOOK.tmpl $REVPROPHOOK
sudo chmod +x $REVPROPHOOK
# set new log message
svn propset -r $1 --revprop svn:log "$2"
# remove pre-revprop-change hook
sudo rm $REVPROPHOOK
The script takes two parameters: the first is the revision number you would like to change the log message for, and the second is the new log message. It makes use of sudo, so you will have to provide your password to gain permission to modify the repository files.
1 Response to “Changing Subversion Log Messages”
Sorry, comments are closed for this article.
May 9th, 2006 at 03:32 PM
So you made it easy for people to break there stuff, even though subversion wanted it to be difficult. What a nice Guy ;-)