Handy Subversion Rake Task

July 31st, 2006

James Hill recently posted this handy rake task to add all files with an svn status flag of ’?’ to your working copy.

namespace :svn do
  desc "Adds all files with an svn status flag of '?'" 
  task(:add_new) { `svn status | awk '/\\?/ {print $2}' | xargs svn add` }
end

You can then call rake svn:add_new to add all your new svn files. I have an alias in my .bash_profile that I use named svnaddall that does the same thing and looks like this:

alias svnaddall='svn status | grep "^\?" | awk "{print \$2}" | xargs svn add'

I also have this alias to clear the subversion in the event that I need to:


	
	
	

Leave a Reply


(textile enabled)