SVN Repository Tricks

Today I learned a new trick from http://www.pgrs.net/2008/1/23/remove-files-that-are-not-in-subversion that I have been able to adapt to a couple different situations.

svn revert un-modifies files, but it leaves new files lying around as cruft. How do I get rid of them?

This command does the trick:

svn st | grep ^\? | cut -c 2- | xargs rm

Also, if you have added directories, you should also run this command

svn st | grep ^\? | cut -c 2- | xargs rm -rf

note: these may not work with files that have spaces in the name.

I used drush to update a module. Is there a quick way to add all the new files to my svn repositroy?

Same code does the trick:

svn st | grep ^\? | cut -c 2- | xargs svn add