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:

REPOS="$1"
REV="$2"
USER="$3"
PROPNAME="$4"
ACTION="$5"

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.

4 thoughts on “How to allow the change of a commit comment in SVN

  1. σεξυ εσωρουχα

    I do trust all tthe ideas you have presented on your post.

    They are very convinccing and will definitely work.

    Still, the posts are too short for beginners. May you please prolong them a little
    from subsequent time? Thank you for the post.

    Reply
  2. Christina

    Skype has opened its internet-dependent buyer beta for the world,
    after introducing it extensively in the United states and You.K.
    earlier this 30 days. Skype for Online also now supports Chromebook
    and Linux for immediate online messaging connection (no
    voice and video yet, these need a connect-in installation).

    The increase of your beta brings support for
    a longer selection of languages to help you strengthen that international
    user friendliness

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *