How do I completely remove a file from the repository's history?
There are special cases where you might want to destroy all evidence of a file or commit. (Perhaps somebody accidentally committed a confidential document.) This isn't so easy, because Subversion is deliberately designed to never lose information. Revisions are immutable trees which build upon one another. Removing a revision from history would cause a domino effect, creating chaos in all subsequent revisions and possibly invalidating all working copies.The project has plans, however, to someday implement an svnadmin obliterate command which would accomplish the task of permanently deleting information. (See issue 516.)
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. See chapter 5 of the Subversion book for details about this.
OK, so what to do now? First of all, check out a previous revision. OK, did that. So now check everything looks fine, everything builds just fine ... OK!
So how to commit that to the repository? The repository know I checked out revision 125, but the latest revision is 126. So what next?
First make a backup of the repository (well, it's kinda broken, but you never now what could happen next!!). Then dump everything up to revision 125:
svnadmin dump -r1:125 myrepo > my.dump
then create a new repository and load the dump:
svnadmin create myrepo
svnadmin load myrepo < my.dump
This way you'll end up with a nice and clean repository, which is up-to-date with revision 125 ... and the bogus revision 126 is gone!!
This really made my day!!
No comments:
Post a Comment