July 31, 2006

Posted by John

Handy Subversion Rake Task

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:

 
      

Tags: rake and subversion

0 Comments

Sorry, comments are closed for this article to ease the burden of pruning spam.

About

Authored by John Nunemaker (Noo-neh-maker), a web developer and programmer who has fallen deeply in love with Ruby. More about John.

Syndication

Feed IconRailsTips Articles - An assortment of howto's and thoughts on Ruby and Rails.

Feed IconRails Quick Tips - Ruby and Rails related links that I find. Never more than 5 a day.