Just read a post from David at Planet Argon showing a way to add un-added files 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.
6 comments ↓
I liked this so much I rolled it into a quick plugin so I can put it in each of my projects.. I stuck it here
./script/plugin install -x https://svn2.cvsdude.com/lussiema/plugins/subversionext
Glad you liked it. It’s the simple things that make life easier.
Jamie,
I’ve got a svn_tools plugin that does all that and more.
rake svn:add / svn:del / svn:commit are the basics, but it also will bootstrap your application into a repository and ignore all the proper file in one fell swoop.
http://jchris.mfdz.com/articles/2006/07/21/subversion-tools-plugin
There is this too:
http://re.visioni.st/articles/2006/06/25/rake-task-easily-configure-subversion
We (as in the Rails communtiy) really need a better way to track plugins.
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.
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 Comment