I don’t know how many years I’ve used the following command chain to add all my unknown files to Subversion:

svn st | grep ? | sed -e "s/? *//" | xargs svn add

Inevitably I occasionally end up using that string on some directory where I have a space in the pathname, and everything bombs. So I finally got around to adding it to my ~/.bash_aliases file today, with the additional -e "s/^(.*)$/\"\1\"/". Simple, really (just make sure that something sources that file):

alias svnaddall='svn st | grep ? | sed -e "s/? //" -e "s/^\(.\)$/\"\1\"/" | xargs svn add'

I may still play with the actual alias name to see what sticks in my every day practice. Maybe I totally missed a way simpler way to do this. Seems like I’ve done something like this since back when I started using Subversion at release 0.18 or 0.19. Maybe I haven’t kept up, so I’d be happy to be enlightened.

Do you have anything tiny hanging around that should be automated right now?

comments powered by Disqus