Create a gist now

Instantly share code, notes, and snippets.

class Command
class << self
def run(command)
output = `#{command} 2>&1`.chomp
if $? != 0
raise " *** Command `#{command}` failed with the following output:\n#{output}"
end
output
end
end
end
Dir.glob(ARGV) do |file|
file =~ /\/\d+-(.*).patch/
commit = $1
system "patch -p0 < #{file}"
# Little snippet of code to basically add and remove everything
Command.run("svn status").each_line do |line|
line.chomp!
status, path = *line.split(/\s+/)
next if path =~ /\.git/
case status
when '!'
Command.run("svn rm #{path}")
when '?'
Command.run("svn add #{path}")
end
end
puts "About to commit #{commit}"
puts system("svn status")
puts "Press any key to continue"
gets
system "svn commit -m #{commit}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment