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

ruby-changes:37755

From: usa <ko1@a...>
Date: Wed, 4 Mar 2015 02:14:41 +0900 (JST)
Subject: [ruby-changes:37755] usa:r49836 (trunk): * tool/redmine-backporter.rb (backport_command_string): pick up only

usa	2015-03-04 02:14:22 +0900 (Wed, 04 Mar 2015)

  New Revision: 49836

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

  Log:
    * tool/redmine-backporter.rb (backport_command_string): pick up only
      when the revision exists in trunk.

  Modified files:
    trunk/ChangeLog
    trunk/tool/redmine-backporter.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 49835)
+++ ChangeLog	(revision 49836)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Mar  4 02:13:06 2015  NAKAMURA Usaku  <usa@r...>
+
+	* tool/redmine-backporter.rb (backport_command_string): pick up only
+	  when the revision exists in trunk.
+
 Wed Mar  4 00:44:56 2015  Nobuyoshi Nakada  <nobu@r...>
 
 	* thread.c (rb_thread_io_blocking_region): assigned variables
Index: tool/redmine-backporter.rb
===================================================================
--- tool/redmine-backporter.rb	(revision 49835)
+++ tool/redmine-backporter.rb	(revision 49836)
@@ -31,8 +31,8 @@ opts.parse!(ARGV) https://github.com/ruby/ruby/blob/trunk/tool/redmine-backporter.rb#L31
 
 http_options = {use_ssl: true}
 http_options[:verify_mode] = OpenSSL::SSL::VERIFY_NONE unless ssl_verify
-openuri_options = {}
-openuri_options[:ssl_verify_mode] = OpenSSL::SSL::VERIFY_NONE unless ssl_verify
+$openuri_options = {}
+$openuri_options[:ssl_verify_mode] = OpenSSL::SSL::VERIFY_NONE unless ssl_verify
 
 TARGET_VERSION = target_version || ENV['TARGET_VERSION'] || (raise 'need to specify TARGET_VERSION')
 RUBY_REPO_PATH = repo_path || ENV['RUBY_REPO_PATH']
@@ -300,6 +300,18 @@ def show_last_journal(http, uri) https://github.com/ruby/ruby/blob/trunk/tool/redmine-backporter.rb#L300
 end
 
 def backport_command_string
+  unless @changesets.respond_to?(:validated)
+    @changesets = @changesets.select do |c|
+      begin
+        uri = URI("#{REDMINE_BASE}/projects/ruby-trunk/repository/revisions/#{c}")
+        uri.read($openuri_options)
+        true
+      rescue
+        false
+      end
+    end
+    @changesets.define_singleton_method(:validated){true}
+  end
   " backport --ticket=#{@issue} #{@changesets.join(',')}"
 end
 
@@ -323,7 +335,7 @@ commands = { https://github.com/ruby/ruby/blob/trunk/tool/redmine-backporter.rb#L335
     raise CommandSyntaxError unless /\A(\d+)?\z/ =~ args
     uri = URI(REDMINE_BASE+'/projects/ruby-trunk/issues.json?'+URI.encode_www_form(@query.dup.merge('page' => ($1 ? $1.to_i : 1))))
     # puts uri
-    res = JSON(uri.read(openuri_options))
+    res = JSON(uri.read($openuri_options))
     @issues = issues = res["issues"]
     from = res["offset"] + 1
     total = res["total_count"]
@@ -342,7 +354,7 @@ commands = { https://github.com/ruby/ruby/blob/trunk/tool/redmine-backporter.rb#L354
     @issue = id
     uri = "#{REDMINE_BASE}/issues/#{id}"
     uri = URI(uri+".json?include=children,attachments,relations,changesets,journals")
-    res = JSON(uri.read(openuri_options))
+    res = JSON(uri.read($openuri_options))
     i = res["issue"]
     unless i["changesets"]
       abort "You don't have view_changesets permission"
@@ -369,6 +381,7 @@ eom https://github.com/ruby/ruby/blob/trunk/tool/redmine-backporter.rb#L381
       sio.puts "== #{x["revision"]} #{x["committed_on"]} #{x["user"]["name"] rescue nil}".color(bold: true, underscore: true)
       sio.puts x["comments"]
     end
+    @changesets = @changesets.sort.uniq
     if i["journals"] && !i["journals"].empty?
       sio.puts "= journals".color(bold: true, underscore: true)
       i["journals"].each do |x|

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

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