Skip to content

Instantly share code, notes, and snippets.

@mloughran
Created March 31, 2010 16:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mloughran/350524 to your computer and use it in GitHub Desktop.
Save mloughran/350524 to your computer and use it in GitHub Desktop.
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