1. Make sure nobody else uses the repo at the time
I think the easiest way would be to remove write-permissions from the repository-folder. E.g. if you access your svn through apache, just chown it from www-data to root and nobody should be able to write anymore:
#chown -R root:root /var/svn/REPOSITORY
2. Dump your repository to a dumpfile
#svnadmin dump /var/svn/REPOSITORY > dumpfile
3. Filter the dumpfile
svndumpfilter exclude /path/of/file/to/remove < dumpfile > newdumpfile
This will remove the file “/path/of/file/to/remove”. You can remove multiple files at a time like this:
#svndumpfilter exclude file1 file2 < dumpfile > newdumpfile
you can also use wildcards:
#svndumpfilter exclude –pattern "*.OLD" < dumpfile > newdumpfile
4. Create a new repository
#svnadmin create /var/svn/REPOSITORY_NEW
5. Import the dumpfile in the new repository
#svnadmin load /var/svn/REPOSITORY_NEW < newdumpfile
6. Replace the old with the new repository
#chown -R www-data:www-data /var/svn/REPOSITORY_NEW
#
mv /var/svn/REPOSITORY /var/svn/REPOSITORY_OLD
#mv /var/svn/REPOSITORY_NEW /var/svn/REPOSITORY
In the first line I also changed the file owner and group to www-data to make the new repository accessible for apache. In case you do not use apache (e.g. svnserve), skip the line or change the file owner and group to your needs (see what the owner of the old repo was using “ls -l /var/svn” ).
7. Check it
You update your working copy (shouldn’t change anything). But when you browse your history and want to see one of the files you removed, you will get an error that the file could not be found.
You might want to make a fresh checkout and a commit to see whether everything still works as expected…
8. Clean up
In case everything went well, you can delete a couple of things:
#rm -R dumpfile newdumpfile /var/svn/REPOSITORY_OLD