Is there any way to delete file from svn repository including all its history? This issue emerges when I want to get rid of large binary file residing in repo.
I know only one approach that might help in this situation:
svnadmin
utility.grep
. Grep should use filename and write in to the other dump-filesvnadmin
But this is too complicated and unreliable. Maybe there is another solution?
To remove a file from a Subversion repository, change to the directory with its working copy and run the following command: svn delete file… Similarly, to remove a directory and all files that are in it, type: svn delete directory…
The simple answer is "no", because Subversion doesn't know how to resolve the case when you add a commit, someone else updates their checkout, and then you remove the commit from history. There might or might not be a complex answer involving surgery on the Subversion storage.
If you right-drag the folder and use "SVN move versioned item(s) here", then you keep the history. Even the history of the files within the folder.
This has recently become much more straightforward with the command svndumpfilter
. Details are available in the subversion documentation here. Basically, to avoid conflicts (explained here), it takes a repo dump and redoes each commit, either including or excluding a given file prefix. Basic syntax:
svndumpfilter exclude yourfileprefix < yourdump > yournewdump
Exclude is probably what the question asker is looking for, but you can also use include to, say, extract a subtree of the repo so as to spin it off as its own repository.
The latest revision of subversion in subversion (very meta) can also take glob patterns. I recently had to remove all pdfs from a repo and it was very easily done like so:
svndumpfilter exclude --pattern '*.pdf' < dump > dump_nopdfs
Further usage information can be found by calling svndumpfilter help
and svndumpfilter help exclude
.
But this is too complicated and unreliable.
I wouldn't know why this shouldn't be considered reliable. However, if you want to completely get rid of the file, history and all, no matter what the effect on previous revisions this file was part of, there only is one way to do so and that way is indeed complicated. And rightly so. SVN is a tool with one single goal: never ever to lose any file, even after it was deleted. Forcing it to do otherwise ought to be hard.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With