How to edit an svn log message

Have you ever, like me, committed a change into SVN (subversion) and found that you used the wrong messages file - meaning that the log message for the revision is wrong?

If so: it's good to know that subversion allows you to change the message - possibly with some help from the administrator. If that's you - so much the better.

Here's one process that could help. This example is for a linux system, but can easily be adapted to others.

When in the working copy folder, try the command (replacing "1234" with the revision number you want to edit the message for).

export SVN_EDITOR=vim
svn propedit -r 1234 --revprop svn:log

This will launch "vim" and allow you to edit the message text. When you're done and you save the updated file svn will attempt to apply the change to the server repository.

It is possible that the svn server is not set up to allow this, in which case you may see something like this..

svn: E165006: Repository has not been enabled to accept revision propchanges;
ask the administrator to create a pre-revprop-change hook

If you see this message then you (assuming you are the admin) can check the "hooks" directory of the server's repository. For example (your repository will almost certainly be in a different place)..

cd /opt/svn/myrepos/hooks
ls -l

Check to see whether there is a file called "pre-revprop-change" listed with execute permissions. If not, and there is a "pre-revprop-change.tmpl" file then review it's contents and if you are happy with the logic it contains, copy it into place. If the file already exists then stop here (dont do the copy) - and investigate why it is preventing your request to update the log.

So, if the file is missing...

cp pre-revprop-change.tmpl pre-revprop-change
chmod +x pre-revprop-change

On my system, the template file has the default contents - namely (excluding comments)..

if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then exit 0; fi
echo "Changing revision properties other than svn:log is prohibited" >&2
exit 1

This allows the log to be modified, but blocks all other edits on revision properties. For our situation, this is perfectly fine.

Once the file is in place, return to the working copy and try again. Hopefully, this time your change will be accepted.

Finally: consider whether you want the hook left in place and remove it if not.



Scroll to Top