From c782c791b23ad95b783697ffd52f8dcce5964931 Mon Sep 17 00:00:00 2001 From: naruse Date: Tue, 29 Mar 2016 09:59:27 +0000 Subject: * tool/redmine-backporter.rb (backport): show merger.rb's path. * tool/redmine-backporter.rb (show): show current issue again if no ticket number is given. * tool/redmine-backporter.rb (rel): show error message if current bugs.ruby-lang.org doesn't support the API. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54390 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- tool/redmine-backporter.rb | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'tool') diff --git a/tool/redmine-backporter.rb b/tool/redmine-backporter.rb index aa9991155c..72046e2498 100755 --- a/tool/redmine-backporter.rb +++ b/tool/redmine-backporter.rb @@ -299,6 +299,10 @@ def show_last_journal(http, uri) puts x["notes"] end +def merger_path + File.expand_path('../merger.rb', __FILE__) +end + def backport_command_string unless @changesets.respond_to?(:validated) @changesets = @changesets.select do |c| @@ -312,7 +316,7 @@ def backport_command_string end @changesets.define_singleton_method(:validated){true} end - " backport --ticket=#{@issue} #{@changesets.join(',')}" + " #{merger_path} --ticket=#{@issue} #{@changesets.join(',')}" end def status_char(obj) @@ -348,10 +352,15 @@ commands = { }, "show" => proc{|args| - raise CommandSyntaxError unless /\A(\d+)\z/ =~ args - id = $1.to_i - id = @issues[id]["id"] if @issues && id < @issues.size - @issue = id + if /\A(\d+)\z/ =~ args + id = $1.to_i + id = @issues[id]["id"] if @issues && id < @issues.size + @issue = id + elsif @issue + id = @issue + else + raise CommandSyntaxError + end uri = "#{REDMINE_BASE}/issues/#{id}" uri = URI(uri+".json?include=children,attachments,relations,changesets,journals") res = JSON(uri.read($openuri_options)) @@ -407,6 +416,12 @@ eom Net::HTTP.start(uri.host, uri.port, http_options) do |http| res = http.post(uri.path, "issue_id=#@issue", 'X-Redmine-API-Key' => REDMINE_API_KEY) + begin + res.value + rescue + $stderr.puts "deployed redmine doesn't have https://github.com/ruby/bugs.ruby-lang.org/commit/01fbba60d68cb916ddbccc8a8710e68c5217171d\nask naruse or hsbt" + return + end puts res.body class << @changesets remove_method(:validated) rescue nil -- cgit v1.2.3