Tag Archives: Tortoise SVN

How to allow the change of a commit comment in SVN

Sometimes you commit something and you forget to write a comment… big mistake, if you ask me. Maybe you did write a comment, but it was wrong. Don’t panic: you can edit it.

What will you need to do so? Two things:

1.- Admin access to the svn server installation.

2.- Tortoise SVN client or svn console. I’ll use Tortoise SVN here.

By default, SVN servers don’t have this option activated, let’s say… so they will not allow you change any comment on any revision, even if you committed the stuff in the first place.

In order to activate it, you have to (assuming that you’re using a unix based server) go to your repo hooks directory. Listing the files in there, you will find a file called pre-revprop-change.tmpl. You will need to remove the extension and do it executable, with the next commands:

mv pre-revprop-change.tmpl pre-revprop-change
chmod 777 pre-revprop-change

No restart is necessary. Now if you do “Show log” on any resource through your Tortoise SVN client, you will be able to do right click on a revision like this:

Right click on Revision

And choose the option “Edit log message”:

Editing Log Message

Ok. Done. We’re happy. We’re good. BUT… what if we only want the people who initially committed the resource to do the change on the comment?, because with the current configuration, anyone will be able to change the revision comment… suddenly this does not seem such a good idea any more, right?

Don’t worry and stay here. This is what you need to do: edit the mentioned pre-revprop-change file updating the next lines:


if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" -a `/usr/local/subversion/bin/svnlook author -r "$REV" "$REPOS"` = "$USER" ]; then exit 0; fi

echo "Changing revision properties other than svn:log is prohibited... and if you were changing svn:log... did you commit this revision at first place?" >&2
exit 1

No restart is necessary after this either.

Obviously /usr/local/subversion/bin/svnlook will have to point to your svnlook path.

With this we’re done. Enjoy it.