Monday, July 20, 2009

When subversion does not add up.

I have been using Subversion to manage all of my active projects -- it is a fantastic tool but I ran into a bit of a problem recently when I accidentally added several hundred log files as I was preparing for a commit (using the automated method I describe here -- so caveat emptor). Most suggestions I found on the internet were some variation of:
$ svn --recursive revert .
The problem with this solution is that all uncommitted changes to existing files (i.e., modified files that were already present in the repository) would be lost. Ouch! I discovered this solution; however, it did not work for me because I had already made the mistake of deleting the offending files. Finally, I modified the suggested command and all is well:
$ svn st | grep log > badfile.txt
$ sed 's/! /.\//' badfile.txt > newfile.txt
$ less newfile.txt | xargs svn revert

No comments: