I wrote a little ruby script to do this:
require 'fileutils'
buffer = ""
CACHE_DIR = File.join(ENV['HOME'], '.svn_interactive_temp')
FileUtils.mkdir_p(CACHE_DIR)
data = IO.popen 'svn stat' do |process|
while process.read(512, buffer)
end
end
def handle_file(file)
system("stty raw")
print "new file: #{file} [a]dd/[i]gnore/[s]kip? "
c = STDIN.getc
system("stty cooked")
exit if c == 3
c = c.chr
success = true
puts
case c
when 'a'
puts "adding the file: #{file}"
system "svn add #{file}"
when 'i'
puts "adding svn:ignore for #{file}"
cache_filename = File.join(CACHE_DIR, (1..10).map{(rand * 10).to_i}.to_s)
p file
parent = File.dirname(file)
system("svn propget svn:ignore #{parent} >> #{cache_filename}")
File.open(cache_filename, 'a') do |f|
f.puts(File.basename(file))
end
system("svn propset svn:ignore -F #{cache_filename} #{parent}")
system("rm #{cache_filename}")
when 's'
puts "skipping: #{file}"
else
success = false
end
success
end
buffer.scan(/\?\s*(.*)$/).each do |file|
while !(handle_file(file.to_s))
sleep(0.01)
end
end
Eg:
sam@sam-ubuntu:~/Source/stuff$ ruby ../scripts/svn_interactive.rb
new file: test.txt [a]dd/[i]gnore/[s]kip? i
adding svn:ignore for test.txt
"test.txt"
property 'svn:ignore' set on '.'