summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-07-06 00:33:03 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-07-06 00:48:33 +0900
commit1aed23c18d2b62bbe68c704fbe6f2d633ffe71ce (patch)
tree1625cdae525ab0622dc25f89331c298b985cec2b
parent8e189df32cacef4b21e357a590d349330532baf5 (diff)
tool/sync_default_gems.rb: Accept multiple commit ranges
-rw-r--r--tool/sync_default_gems.rb21
1 files changed, 12 insertions, 9 deletions
diff --git a/tool/sync_default_gems.rb b/tool/sync_default_gems.rb
index 24a7a39119..da41f1aa25 100644
--- a/tool/sync_default_gems.rb
+++ b/tool/sync_default_gems.rb
@@ -313,7 +313,7 @@ end
IGNORE_FILE_PATTERN = /\A(?:\.travis.yml|appveyor\.yml|azure-pipelines\.yml|\.git(?:ignore|hub)|Gemfile|README\.md|History\.txt|Rakefile|CODE_OF_CONDUCT\.md)/
-def sync_default_gems_with_commits(gem, range)
+def sync_default_gems_with_commits(gem, ranges)
puts "Sync #{$repositories[gem.to_sym]} with commit history."
IO.popen(%W"git remote") do |f|
@@ -323,12 +323,14 @@ def sync_default_gems_with_commits(gem, range)
end
system(*%W"git fetch --no-tags #{gem}")
- unless range.include?("..")
- range = "#{range}~1..#{range}"
- end
+ commits = ranges.flat_map do |range|
+ unless range.include?("..")
+ range = "#{range}~1..#{range}"
+ end
- commits = IO.popen(%W"git log --format=%H,%s #{range}") do |f|
- f.read.split("\n").reverse.map{|commit| commit.split(',', 2)}
+ IO.popen(%W"git log --format=%H,%s #{range}") do |f|
+ f.read.split("\n").reverse.map{|commit| commit.split(',', 2)}
+ end
end
# Ignore Merge commit and insufficiency commit for ruby core repository.
@@ -467,9 +469,10 @@ when nil, "-h", "--help"
exit
else
- if ARGV[1]
- sync_default_gems_with_commits(ARGV[0], ARGV[1])
+ gem = ARGV.shift
+ if ARGV[0]
+ sync_default_gems_with_commits(gem, ARGV)
else
- sync_default_gems(ARGV[0])
+ sync_default_gems(gem)
end
end