ruby-changes:64758
From: Nobuyoshi <ko1@a...>
Date: Tue, 5 Jan 2021 21:47:41 +0900 (JST)
Subject: [ruby-changes:64758] 06454a9457 (master): sync_default_gems.rb: added -a option
https://git.ruby-lang.org/ruby.git/commit/?id=06454a9457 From 06454a9457e3c6fd819eb1ad6a9aa5b32eb083b1 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Tue, 5 Jan 2021 21:24:10 +0900 Subject: sync_default_gems.rb: added -a option The option to merge all commits since the commit merged in the last prefixed commit. diff --git a/tool/sync_default_gems.rb b/tool/sync_default_gems.rb index 6db42b6..1fed998 100644 --- a/tool/sync_default_gems.rb +++ b/tool/sync_default_gems.rb @@ -353,6 +353,11 @@ def sync_default_gems_with_commits(gem, ranges, edit: nil) https://github.com/ruby/ruby/blob/trunk/tool/sync_default_gems.rb#L353 end system(*%W"git fetch --no-tags #{gem}") + if ranges == true + log = IO.popen(%W"git log --fixed-strings --grep=[#{repo}] -n1 --format=%B", &:read) + ranges = ["#{log[%r[https://github\.com/#{Regexp.quote(repo)}/commit/(\h+)\s*\Z], 1]}..#{gem}/master"] + end + commits = ranges.flat_map do |range| unless range.include?("..") range = "#{range}~1..#{range}" @@ -523,13 +528,21 @@ when nil, "-h", "--help" https://github.com/ruby/ruby/blob/trunk/tool/sync_default_gems.rb#L528 exit else - if ARGV[0] == "-e" - edit = true - ARGV.shift + while /\A-/ =~ ARGV[0] + case ARGV[0] + when "-e" + edit = true + ARGV.shift + when "-a" + auto = true + ARGV.shift + end end gem = ARGV.shift if ARGV[0] sync_default_gems_with_commits(gem, ARGV, edit: edit) + elsif auto + sync_default_gems_with_commits(gem, true, edit: edit) else sync_default_gems(gem) end -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/