A place where the Joyent community can gather, help each other out, and stay informed.
You are not logged in.
What I want to do is just type one command (svn add-new or something) and have all the new files not yet versioned in the working copy changed from "?" to "A".
Is there some way to do this with svn? I wrote a ruby script to do the same, but it would make sense that this is somewhere in svn itself already, so I just wondered. Here's the script I wrote in case my description above isn't clear:
#!/usr/bin/env ruby
- checks to see if argument is passed, and works on said file
- or assumes current directory is a working copy and works from there
unless ARGV.empty?
directory = ARGV
status = `cd #{directory};svn status`.split("\n")
else
status = `svn status`.split("\n")
end
status.each do |line|
match = /^\?\t*.*/.match(line).to_s.split # matches all files not yet added to repo (status: ?)
unless match1.nil?
puts " adding: \t #{match1}"
`svn add #{match1}`
end
end
Offline
Would something like
Dir['**/*'].each {|file| `svn add #{file}`}
do it?
Wait... the docs say svn add is recursive, but it gives examples with a given directory name. So, maybe
Dir['**'].each {|file| `svn add #{file}`}
will do it?
Last edited by yerejm (2005-03-14 07:32:04)
Offline
How about
svn status | grep "^\?" | awk '{print $2}' | xargs svn add
Offline
Aha!! Now you're talking...
And then add the following to your .bash_profile
svn_add_all(){
svn status | grep "^\?" | awk '{print $2}' | xargs svn add
}
Good one
Offline
svn add --force dirname
Offline
svn add --force *
Offline