Category Archives: SVN

Removing local SVN metadata

When you control the versions of your project codebase in SVN, one of the things that SVN does is keeping some files in the local working copy of the project. As explained in the wikipedia:

Subversion stores additional copies of data on the local machine, which can become an issue with very large projects or files, or if developers work on multiple branches simultaneously. These .svn directories on the client side can become corrupted by ill-advised user activity.

If, for some reason, you want to disconnect your local copy of your project from the SVN server version, in other words, you just want your project to be local and not be linked at all with a version control system, the best way to do it is through a graphic SVN client, preferably the one you used to connect it in the first place. Two graphic ways (Eclipse plugin and Tortoise SVN) of doing this and the command line one are described here:

1.- Eclipse plugin: Subversion, Subclipse. I am using Subclipse here. Just do right click on the name of the project, go to Team -> Disconnect. You will get a prompt like this:

Make sure you change it to:

Before hitting Yes.

2.- Tortoise SVN: imagine you have your project like this:

There is no direct tool through the Tortoise SVN client to do this, but your best shot is exporting your local working copy. This will recreate the project without any .svn directory or local SVN metadata. So we do right click on the project name, TortoiseSVN -> Export:


Click OK and there you go, project in dummyExported does NOT contain any .svn folder hence it’s not connected whatsover to any SVN repository from a local point of view. The original working copy is still there, so you can remove it completely and copy the exported one to the original location is this is necessary for you.

3.- Command line: as usual, there is a much quicker and cleaner way to do this with the command line (assuming you are in a Unix-like machine or you have at least a Unix-like console at your disposal, like Cygwin). It is explained quite well here, but in case you’re in a rush:

$ rm -rf `find . -type d -name .svn`

If you type that from the current directory of the project you want to disconnect, every single .svn directory on it and on its subdirectories will be erased, hence the local working copy disconnected from the SVN repository.

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.