зеркало из https://github.com/github/ruby.git
tool/sync_default_gems.rb: Accept multiple commit ranges
This commit is contained in:
Родитель
8e189df32c
Коммит
1aed23c18d
|
@ -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,13 +323,15 @@ def sync_default_gems_with_commits(gem, range)
|
|||
end
|
||||
system(*%W"git fetch --no-tags #{gem}")
|
||||
|
||||
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|
|
||||
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.
|
||||
commits.delete_if do |sha, subject|
|
||||
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче