summaryrefslogtreecommitdiff
path: root/tool/redmine-backporter.rb
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-03 17:14:22 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-03 17:14:22 +0000
commitbca791ae604bfb1166c1d9d821697751a6248bc6 (patch)
tree2d1d31c127150dae2ddc199a1f82772910b0927a /tool/redmine-backporter.rb
parentf6ed283fd5b22a6abb2b69ef06ed9850c9a5e611 (diff)
* tool/redmine-backporter.rb (backport_command_string): pick up only
when the revision exists in trunk. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/redmine-backporter.rb')
-rwxr-xr-xtool/redmine-backporter.rb21
1 files changed, 17 insertions, 4 deletions
diff --git a/tool/redmine-backporter.rb b/tool/redmine-backporter.rb
index 15b6e34..d3f4c24 100755
--- a/tool/redmine-backporter.rb
+++ b/tool/redmine-backporter.rb
@@ -31,8 +31,8 @@ opts.parse!(ARGV)
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)
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 = {
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 = {
@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
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|