svn status | grep ^? | sed -r -e 's/^\?\s+//' | xargs svn add
This finds all the files in the current directory that svn doesn't know about, strips off the beginning question mark and spaces, and adds them to svn one at a time. Perfect.
UPDATE:
I just discovered there's a rake task that does this for you. Simply type "rake add". For a listing of all the default rake tasks, just type "rake --tasks".
UPDATE2:
The 'rake add' task I mentioned in the last update actually isn't a default task. When I configured my system for subversion, I read some blogs on how to configure it to exclude log/ and tmp/, etc. I copied the code I found into a rake task and forgot about it. It turns out I copied a command for adding new files to subversion and it looks almost identical to the one I came up with. That being said, to make the above work as a rake task, include it in your lib/tasks folder. For instance, in a file called lib/tasks/svn.rake:
namespace :svn do
desc "Add new files to subversion repository"
task :add_new_files do
system "svn status | grep ^? | sed -r -e 's/^\?\s+//' | xargs svn add"
end
end
Then simply call 'rake svn:add_new_files' to run it.
No comments:
Post a Comment