Skip to content

Commit

Permalink
A many-commits wrapper for port-one.rb.
Browse files Browse the repository at this point in the history
git-svn-id: https://ncisvn.nci.nih.gov/svn/psc/trunk@7027 0d517254-b314-0410-acde-c619094fa49f
  • Loading branch information
Rhett Sutphin committed Sep 26, 2011
1 parent 5a34170 commit ce7afef
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions port-many.rb
@@ -0,0 +1,43 @@
#!/usr/bin/env ruby

require 'rubygems'
require 'highline'

######
# Repeatedly invokes port-one.rb for a series of commits.
# Example:
#
# ./port-many.rb 6700-6703 6811
#
# This is equivalent to:
#
# ./port-one.rb 6700
# ./port-one.rb 6701
# ./port-one.rb 6702
# ./port-one.rb 6703
# ./port-one.rb 6811

HL=HighLine.new
PORT_ONE = File.expand_path('../port-one.rb', __FILE__)

commits = ARGV.collect { |entered|
if entered =~ /-/
start, stop = entered.split('-', 2).collect(&:to_i)
(start..stop).to_a
else
entered.to_i
end
}.flatten

unless HL.agree("About to port #{commits.join(", ")}, one at a time. Continue?")
exit(0)
end

until commits.empty?
HL.say("#{commits.size} left")
commit = commits.shift
unless system("#{PORT_ONE} #{commit}")
puts "#{commit} failed; #{commits.join(', ')} not attempted"
exit(1)
end
end

0 comments on commit ce7afef

Please sign in to comment.