SVN vs Orwell

Not long ago I had to change history in GIT. Now I happened to commit to Subversion a revision, but forgot to limit the files to only relevant to the log entry and thus committed all changed files. Nothing really bad, but the entry was minor, compared to all the changes and I did not want those to go unnoticed in the log. I did not think one can take back files from an already committed revision, so I searched out for a solution to change the log entry. It turns out this is relatively simple, as the Subversion FAQ points out.

Enable revprop change

First step is to enable changes to revision properties. To do this, you need to set up a pre-revprop-change hook in the repository at the subversion server itself as described in the manual: change to repository hooks dir and copy the template as script:

[root@db /srv/svn/eenet/hooks]# cp pre-revprop-change.tmpl pre-revprop-change
[root@db /srv/svn/eenet/hooks]# chmod 755 pre-revprop-change
cd /srv/repo/hooks
cp pre-revprop-change.tmpl pre-revprop-change
chmod 755 pre-revprop-change

Edit the log

Now just reopen the log entry and edit as apropriate. First change to the working copy and then enter:

svn propedit -r N --revprop svn:log

where N is the revision number. This opens up your $EDITOR and when you save the file commits the new log message.
If you think you need this ability again in the future, you can leave the hooks in the place, otherwise remove it to avoid accidental changes to the properties SVN assumes to stay unchanged.

SVN - Orwell
 0  -  1

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s