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

ruby-changes:33061

From: naruse <ko1@a...>
Date: Sat, 22 Feb 2014 22:43:19 +0900 (JST)
Subject: [ruby-changes:33061] naruse:r45140 (trunk): add backport commit detection

naruse	2014-02-22 22:43:16 +0900 (Sat, 22 Feb 2014)

  New Revision: 45140

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45140

  Log:
    add backport commit detection

  Modified files:
    trunk/tool/redmine-backporter.rb
Index: tool/redmine-backporter.rb
===================================================================
--- tool/redmine-backporter.rb	(revision 45139)
+++ tool/redmine-backporter.rb	(revision 45140)
@@ -199,6 +199,10 @@ def mergeinfo https://github.com/ruby/ruby/blob/trunk/tool/redmine-backporter.rb#L199
   `svn propget svn:mergeinfo #{RUBY_REPO_PATH}`
 end
 
+def find_svn_log(pattern)
+  `svn log --xml --stop-on-copy --search='#{pattern}' #{RUBY_REPO_PATH}`
+end
+
 def show_last_journal(http, uri)
   res = http.get("#{uri.path}?include=journals")
   res.value
@@ -216,7 +220,7 @@ def show_last_journal(http, uri) https://github.com/ruby/ruby/blob/trunk/tool/redmine-backporter.rb#L220
 end
 
 def backport_command_string
-  "backport --ticket=#{@issue} #{@changesets.join(',')}"
+  " backport --ticket=#{@issue} #{@changesets.join(',')}"
 end
 
 console = IO.console
@@ -298,6 +302,7 @@ eom https://github.com/ruby/ruby/blob/trunk/tool/redmine-backporter.rb#L302
 
   when /\Adone(?: +(\d+))?(?: -- +(.*))?\z/
     notes = $2
+    notes.strip! if notes
     if $1
       i = $1.to_i
       i = @issues[i]["id"] if @issues && i < @issues.size
@@ -308,6 +313,23 @@ eom https://github.com/ruby/ruby/blob/trunk/tool/redmine-backporter.rb#L313
       next
     end
 
+    log = find_svn_log("##@issue]")
+    if log
+      rev = log[/revision="(\d+)/, 1]
+      str = log[/merge revision\(s\) ([^:]+)(?=:)/]
+      str.insert(5, "d")
+      str = "ruby_#{TARGET_VERSION.tr('.','_')} r#{rev} #{str}."
+      if notes
+        str << "\n"
+        str << notes
+      end
+      notes = str
+    else
+      puts "no commit is found whose log include ##@issue"
+      next
+    end
+    puts notes
+
     uri = URI("#{REDMINE_BASE}/issues/#{@issue}.json")
     Net::HTTP.start(uri.host, uri.port, http_options) do |http|
       res = http.get(uri.path)

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

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