summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-01-05 21:24:10 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2021-01-05 21:24:10 +0900
commit06454a9457e3c6fd819eb1ad6a9aa5b32eb083b1 (patch)
tree35cd92dbf0b702c7183b094cdd432ae3126f1d08
parent075824ebd53932898015fa264c7b8b8804c946b0 (diff)
sync_default_gems.rb: added -a option
The option to merge all commits since the commit merged in the last prefixed commit.
-rw-r--r--tool/sync_default_gems.rb19
1 files changed, 16 insertions, 3 deletions
diff --git a/tool/sync_default_gems.rb b/tool/sync_default_gems.rb
index 6db42b6dfc..1fed998af4 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)
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"
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