ruby-changes:62135
From: Nobuyoshi <ko1@a...>
Date: Mon, 6 Jul 2020 00:54:43 +0900 (JST)
Subject: [ruby-changes:62135] 1aed23c18d (master): tool/sync_default_gems.rb: Accept multiple commit ranges
https://git.ruby-lang.org/ruby.git/commit/?id=1aed23c18d From 1aed23c18d2b62bbe68c704fbe6f2d633ffe71ce Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Mon, 6 Jul 2020 00:33:03 +0900 Subject: tool/sync_default_gems.rb: Accept multiple commit ranges diff --git a/tool/sync_default_gems.rb b/tool/sync_default_gems.rb index 24a7a39..da41f1a 100644 --- a/tool/sync_default_gems.rb +++ b/tool/sync_default_gems.rb @@ -313,7 +313,7 @@ end https://github.com/ruby/ruby/blob/trunk/tool/sync_default_gems.rb#L313 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) https://github.com/ruby/ruby/blob/trunk/tool/sync_default_gems.rb#L323 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" https://github.com/ruby/ruby/blob/trunk/tool/sync_default_gems.rb#L469 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 -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/