Created
March 31, 2010 16:19
-
-
Save mloughran/350524 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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