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

ruby-changes:55578

From: Takashi <ko1@a...>
Date: Sun, 28 Apr 2019 20:19:38 +0900 (JST)
Subject: [ruby-changes:55578] Takashi Kokubun:4d8ad48f7d (trunk): Support git as redmine-backporter's done destination

https://git.ruby-lang.org/ruby.git/commit/?id=4d8ad48f7d

From 4d8ad48f7dc610f58150daf92a859ed53fdd3a6c Mon Sep 17 00:00:00 2001
From: Takashi Kokubun <takashikkbn@g...>
Date: Sun, 28 Apr 2019 19:33:41 +0900
Subject: Support git as redmine-backporter's done destination


diff --git a/tool/redmine-backporter.rb b/tool/redmine-backporter.rb
index eef8bbb..3c2d46d 100755
--- a/tool/redmine-backporter.rb
+++ b/tool/redmine-backporter.rb
@@ -9,6 +9,7 @@ require 'strscan' https://github.com/ruby/ruby/blob/trunk/tool/redmine-backporter.rb#L9
 require 'optparse'
 require 'abbrev'
 require 'pp'
+require 'shellwords'
 begin
   require 'readline'
 rescue LoadError
@@ -239,6 +240,10 @@ def find_svn_log(pattern) https://github.com/ruby/ruby/blob/trunk/tool/redmine-backporter.rb#L240
   `svn log --xml --stop-on-copy --search="#{pattern}" #{RUBY_REPO_PATH}`
 end
 
+def find_git_log(pattern)
+  `git #{RUBY_REPO_PATH ? "-C #{RUBY_REPO_PATH.shellecape}" : ""} log --grep="#{pattern}"`
+end
+
 def show_last_journal(http, uri)
   res = http.get("#{uri.path}?include=journals")
   res.value
@@ -431,11 +436,19 @@ eom https://github.com/ruby/ruby/blob/trunk/tool/redmine-backporter.rb#L436
       next
     end
 
-    log = find_svn_log("##@issue]")
-    if log && /revision="(?<rev>\d+)/ =~ log
+    if system("svn info #{RUBY_REPO_PATH&.shellescape} > /dev/null 2>&1") # SVN
+      if log = find_svn_log("##@issue]") && /revision="(?<rev>\d+)/ =~ log
+        rev = "r#{rev}"
+      end
+    else # Git
+      if log = find_git_log("##@issue]")
+        /^commit (?<rev>\h{40})$/ =~ log
+      end
+    end
+    if log && rev
       str = log[/merge revision\(s\) ([^:]+)(?=:)/]
       str.insert(5, "d")
-      str = "ruby_#{TARGET_VERSION.tr('.','_')} r#{rev} #{str}."
+      str = "ruby_#{TARGET_VERSION.tr('.','_')} #{rev} #{str}."
       if notes
         str << "\n"
         str << notes
-- 
cgit v0.10.2


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

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