How to edit commited subversion logs?

When you put a mistake into some of your comments in subversion repository it's no need to cry. There are simple ways to correct your mistakes. I will show you two most common possibilities.

Configure subversion to allow revision properties changes

Properties in svn are unversioned but because by default subversion disallow modification of this, you need to add pre-revprop-change hook script. Here is simple hook script which allow changes of svn:log property and no other (in general your script must return exit status '0' for allowing changes and '1' to disallow). Script should be located in default hook scripts directory - in most distributions in /var/lib/svn/hooks/

(Content of pre-revprop-change script)
#!/bin/sh
REPOS="$1"
REV="$2" USER="$3"
PROPNAME="$4"
ACTION="$5"
if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then
   echo "$1 $2 $3 $4 $5" >> /var/lib/svn/logchanges.log
  exit 0;
fi
echo "Changing revision properties other than svn:log is prohibited" >&2
exit 1

Now your are able to make changes to your comments with svn propset command:

svn propset --revprop -r N svn:log "Modified log entry."
property 'svn:log' set on repository revision 'N'

where N is a revision number

Quick change with svnadmin command

If you have administration privileges you can simply run:

svnadmin setlog --bypass-hooks REPOS_PATH -r N FILE

where REPOS_PATH is the path to the repository on the server and N is the revision number and FILE is a text file containing the correct commit log entry.

Comments

wrote

Wow, that's a rlelay clever way of thinking about it!

Jennis

Jennis wrote

More posts of this quality. Not the usual c***, pelsae

Henny

Henny wrote

I really coldun't ask for more from this article.

Comment