Handy Subversion Rake task

Just read a post from “David”:http://david.planetargon.us at “Planet Argon”:http://planetargon.us/ showing a way to “add un-added files”:http://david.planetargon.us/articles/2006/07/28/i-love-shell-scripting in your Subversion working copy.

I have made this into a simple rake task:

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

Just drop this code in a file called subversion.rake inside the tasks directory. Now you can run rake svn:add_new which will add all new files with an svn status flag of ‘?’ in your working copy.

Published by

Jamie

Hi, I am the Managing Director of SonicIQ Limited in the UK. I have been working in the web development industry since 1999 and have been running SonicIQ since 2001. Currently Ruby On Rails is my preferred development platform. I am experienced in designing with web standards, HTML5, CSS3 and Javascript.

6 thoughts on “Handy Subversion Rake task”

  1. Thanks for these, I didn’t realise they existed. It makes you wonder what other useful plugins are out there which have been left undiscovered.

  2. Is there any way to map the rake tasks to the capistrano/scm libraries?

    I have been thinking about creating a config file (maybe config/repository.rb?) then getting rake to read the config and use the capistrano libraries to checkin/checkout/update/etc from source control.

    The config would look something like:
    repository: http://dev.rubyonrails.org/svn/rails/trunk
    adapter: svn
    username: askegg
    password: mypassword

    and enable:
    rake checkout/checkin/update/diff/etc

    Unfortunately, I do not have the skills with ruby/rails to pull this off (yet). Any takers, or is this a bad idea?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>