Skip the some of commits when sync default gems from upstream.
* Skip failed to sync commits because it needs to pick manually. * Skip empty commit.
This commit is contained in:
parent
012d39c4e6
commit
58bb7f0ca1
@ -259,14 +259,30 @@ def sync_default_gems_with_commits(gem, range)
|
|||||||
puts commits.map{|commit| commit.join(": ")}.join("\n")
|
puts commits.map{|commit| commit.join(": ")}.join("\n")
|
||||||
puts "----"
|
puts "----"
|
||||||
|
|
||||||
|
failed_commits = []
|
||||||
|
|
||||||
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}`
|
skipped = false
|
||||||
unless $?.success?
|
result = IO.popen(%W"git cherry-pick #{sha}").read
|
||||||
puts "Failed to pick #{sha}"
|
if result =~ /nothing\ to\ commit/
|
||||||
break
|
`git reset`
|
||||||
|
skipped = true
|
||||||
|
puts "Skip empty commit #{sha}"
|
||||||
end
|
end
|
||||||
|
next if skipped
|
||||||
|
|
||||||
|
if result.empty?
|
||||||
|
failed_commits << sha
|
||||||
|
`git reset` && `git checkout .` && `git clean -fd`
|
||||||
|
skipped = true
|
||||||
|
puts "Failed to pick #{sha}"
|
||||||
|
end
|
||||||
|
next if skipped
|
||||||
|
|
||||||
|
puts "Update commit message: #{sha}"
|
||||||
|
|
||||||
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`
|
||||||
@ -275,6 +291,8 @@ def sync_default_gems_with_commits(gem, range)
|
|||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
puts failed_commits
|
||||||
end
|
end
|
||||||
|
|
||||||
def sync_lib(repo)
|
def sync_lib(repo)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user