We can easily remove it from the application at our development machine and give a commit to the repository. But the data still remains in the previous commits. Here we have to find a solution for removing the files from revision history. If we get a fine method to do this, we can also help our customers with their repository quota management, also other Application Maintenance and Support.
I have done some testing with the ‘svndumpfilter’ option and could succeed to find a solution for removing files from the revision history of SVN repository. If anyone face an issue with svn repository over quota or interested in removing unwanted files from the history, you can follow the steps given below:
1. Take a dump of your repository.
svnadmin dump /var/svn/REPOSITORY > dumpfile
2. Filter the dump file.
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
3. Create a new repository.
svnadmin create /var/svn/REPOSITORY_NEW
4. Import the dumpfile in the new repository.
svnadmin load /var/svn/REPOSITORY_NEW < newdumpfile
5. Replace the old repository with the new one.
mv /var/svn/REPOSITORY /var/svn/REPOSITORY_OLD
mv /var/svn/REPOSITORY_NEW /var/svn/REPOSITORY
To check this, browse your history and see one of the files you removed, you will get an error that the file could not be found. You might need to make a fresh checkout and a commit to see whether everything works as expected. If everything works fine, we can remove the dump files and old repository backup.