mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Ignore Merge commit and insufficiency commit for ruby core repository.
This commit is contained in:
parent
071bf88970
commit
95aa60f6cd
1 changed files with 27 additions and 19 deletions
|
@ -238,31 +238,39 @@ def sync_default_gems_with_commits(gem, range)
|
||||||
end
|
end
|
||||||
`git fetch --no-tags #{gem}`
|
`git fetch --no-tags #{gem}`
|
||||||
|
|
||||||
|
commits = []
|
||||||
|
|
||||||
IO.popen(%W"git log --format=%H,%s #{range}") do |f|
|
IO.popen(%W"git log --format=%H,%s #{range}") do |f|
|
||||||
commits = f.read.split("\n").reverse.map{|commit| commit.split(',')}
|
commits = f.read.split("\n").reverse.map{|commit| commit.split(',')}
|
||||||
|
end
|
||||||
|
|
||||||
# Ignore Merge commit for ruby core repository.
|
# Ignore Merge commit and insufficiency commit for ruby core repository.
|
||||||
commits.delete_if{|_, subject| subject =~ /^Merge/}
|
commits.delete_if do |sha, subject|
|
||||||
|
files = []
|
||||||
|
IO.popen(%W"git diff-tree --no-commit-id --name-only -r #{sha}") do |f|
|
||||||
|
files = f.read.split("\n")
|
||||||
|
end
|
||||||
|
subject =~ /^Merge/ || files.all?{|file| file =~ /(\.travis.yml|appveyor\.yml|azure\-pipelines\.yml|\.gitignore|Gemfile|README\.md)/}
|
||||||
|
end
|
||||||
|
|
||||||
puts "Try to pick these commits:"
|
puts "Try to pick these commits:"
|
||||||
puts commits.map{|commit| commit.join(": ")}.join("\n")
|
puts commits.map{|commit| commit.join(": ")}.join("\n")
|
||||||
|
puts "----"
|
||||||
|
|
||||||
commits.each do |sha, subject|
|
commits.each do |sha, subject|
|
||||||
puts "Pick #{sha} from #{$repositories[gem.to_sym]}."
|
puts "Pick #{sha} from #{$repositories[gem.to_sym]}."
|
||||||
|
|
||||||
`git cherry-pick #{sha}`
|
`git cherry-pick #{sha}`
|
||||||
unless $?.success?
|
unless $?.success?
|
||||||
puts "Failed to pick #{sha}"
|
puts "Failed to pick #{sha}"
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
prefix = "[#{($repositories[gem.to_sym])}]".gsub(/\//, '\/')
|
||||||
prefix = "[#{($repositories[gem.to_sym])}]".gsub(/\//, '\/')
|
suffix = "https://github.com/#{($repositories[gem.to_sym])}/commit/#{sha[0,10]}"
|
||||||
suffix = "https://github.com/#{($repositories[gem.to_sym])}/commit/#{sha[0,10]}"
|
`git filter-branch -f --msg-filter 'sed "1s/^/#{prefix} /" && echo && echo #{suffix}' -- HEAD~1..HEAD`
|
||||||
`git filter-branch -f --msg-filter 'sed "1s/^/#{prefix} /" && echo && echo #{suffix}' -- HEAD~1..HEAD`
|
unless $?.success?
|
||||||
unless $?.success?
|
puts "Failed to modify commit message of #{sha}"
|
||||||
puts "Failed to modify commit message of #{sha}"
|
break
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue