Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have an SVN repository hosted on a freemium site with a maximum repository size. As I approach this capacity I am aware of files I've checked in that I know I can remove permanently to free up disk space. How do I tell SVN that a file can not only be deleted, but it's history as well?

share|improve this question

4 Answers 4

From the Subversion FAQ:

The project has plans ... to someday implement an svnadmin obliterate command which would accomplish the task of permanently deleting information.

...

In the meantime, your only recourse is to svnadmin dump your repository, then pipe the dumpfile through svndumpfilter (excluding the bad path) into an svnadmin load command.

share|improve this answer

You can't remove a file from SVN repository without doing the svnadmin dump; svndumpfilter; svnadmin load dance. You can reduce the size of the repository if you are using FSFS, just run svnadmin pack on the repo directory.

share|improve this answer

Generally it is a bad idea to remove files from a repository under version control.

I'm not sure I've got it right, but this is how I understand it. Version control is about unique checksums. If you remove something, there is a risk for these checksums to be reused, which leads to conflicts. It is simply not worth it to mitigate a low disk space issue this way, better upgrade your data plan.

share|improve this answer

as Hubert says, svnadmin pack will pack all the individual repo files in a directory into a single big file. This will save you some space, but it's only putting off the day of reckoning for you. (it should make history operations faster though, so its a good suggestion anyway). One thing to note is that it only works on sharded directories (ie the new directory structure is to put 1000 revisions into a single directory, then start a new directory) and it only packs the old shard directories, not the one with the current revision in it.

So, your only option is to delete old revisions from your history. That requires svnadmin dump and load, with optionally a filter to remove directories in your repo you no longer require. (eg old temporary branches).

To dump is easy: svnadmin dump -r xxx:HEAD where xxx is the oldest revision you want to keep (ie this will dump the most recent ones, so your ancient revision are discarded, like archiving). You can keep the archive of the old revisions by dumping them too (svnadmin dump -r 1:xxx)

Once you have your dumpfile, loading it is as easy as running svnadmin load passing in the dumpfile name. it might be a good idea to delete the old repo before loading the new one - then you get the benefit of the latest server filesystem properties, if you don't already have them.

If you want to keep all the old revisions but filter out certain directories, you'll want to run the dumpfile through svndumpfilter, which will remove specified paths. Be aware you'll want to dump without using the --incremental option.

Obviously, test all the operations locally - dump to a local file, then load it into a temp repo on your local drive (it'll be faster too) and test that history and latest version works ok - I export the latest revision to a directory and use winmerge to check that the files are identical to an export of the latest revision from the live repo. Try it with a historical revision too if you want to be paranoid.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.