[前][次][番号順一覧][スレッド一覧]

ruby-changes:56672

From: Hiroshi <ko1@a...>
Date: Sat, 27 Jul 2019 16:47:55 +0900 (JST)
Subject: [ruby-changes:56672] Hiroshi SHIBATA: 58bb7f0ca1 (master): Skip the some of commits when sync default gems from upstream.

https://git.ruby-lang.org/ruby.git/commit/?id=58bb7f0ca1

From 58bb7f0ca1468629a379c74f637bdb04e1e5dfe7 Mon Sep 17 00:00:00 2001
From: Hiroshi SHIBATA <hsbt@r...>
Date: Sat, 27 Jul 2019 11:31:07 +0800
Subject: 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.

diff --git a/tool/sync_default_gems.rb b/tool/sync_default_gems.rb
index 408614f..33703d0 100644
--- a/tool/sync_default_gems.rb
+++ b/tool/sync_default_gems.rb
@@ -259,14 +259,30 @@ def sync_default_gems_with_commits(gem, range) https://github.com/ruby/ruby/blob/trunk/tool/sync_default_gems.rb#L259
   puts commits.map{|commit| commit.join(": ")}.join("\n")
   puts "----"
 
+  failed_commits = []
+
   commits.each do |sha, subject|
     puts "Pick #{sha} from #{$repositories[gem.to_sym]}."
 
-    `git cherry-pick #{sha}`
-    unless $?.success?
+    skipped = false
+    result = IO.popen(%W"git cherry-pick #{sha}").read
+    if result =~ /nothing\ to\ commit/
+      `git reset`
+      skipped = true
+      puts "Skip empty commit #{sha}"
+    end
+    next if skipped
+
+    if result.empty?
+      failed_commits << sha
+      `git reset` && `git checkout .` && `git clean -fd`
+      skipped = true
       puts "Failed to pick #{sha}"
-      break
     end
+    next if skipped
+
+    puts "Update commit message: #{sha}"
+
     prefix = "[#{($repositories[gem.to_sym])}]".gsub(/\//, '\/')
     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`
@@ -275,6 +291,8 @@ def sync_default_gems_with_commits(gem, range) https://github.com/ruby/ruby/blob/trunk/tool/sync_default_gems.rb#L291
       break
     end
   end
+
+  puts failed_commits
 end
 
 def sync_lib(repo)
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]