summaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
authork0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-04-21 14:24:38 +0000
committerk0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-04-21 14:24:38 +0000
commitb6fd7b1bb741edfe08b9f9da4652b5e1d5d3a57a (patch)
tree2dd7a95267f243ee79783958a316499e29aa50e0 /tool
parentc7db05d216cc4c72bed494d026898784ba6b3b5b (diff)
tool/redmine-backporter.rb: Git support in backport/rel
close https://github.com/ruby/ruby/pull/2138 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67697 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool')
-rwxr-xr-xtool/redmine-backporter.rb22
1 files changed, 16 insertions, 6 deletions
diff --git a/tool/redmine-backporter.rb b/tool/redmine-backporter.rb
index 241b285d41..eef8bbb3ca 100755
--- a/tool/redmine-backporter.rb
+++ b/tool/redmine-backporter.rb
@@ -262,9 +262,11 @@ end
def backport_command_string
unless @changesets.respond_to?(:validated)
@changesets = @changesets.select do |c|
- # check if the revision is included in trunk
+ next false if c.match(/\A\d{1,6}\z/) # skip SVN revision
+
+ # check if the Git revision is included in trunk
begin
- uri = URI("#{REDMINE_BASE}/projects/ruby-trunk/repository/trunk/revisions/#{c}")
+ uri = URI("#{REDMINE_BASE}/projects/ruby-trunk/repository/ruby-git/revisions/#{c}")
uri.read($openuri_options)
true
rescue
@@ -369,13 +371,21 @@ eom
"rel" => proc{|args|
# this feature requires custom redmine which allows add_related_issue API
- raise CommandSyntaxError unless /\Ar?(\d+)\z/ =~ args
+ case args
+ when /\Ar?(\d+)\z/ # SVN
+ rev = $1
+ uri = URI("#{REDMINE_BASE}/projects/ruby-trunk/repository/trunk/revisions/#{rev}/issues.json")
+ when /\A\h{7,40}\z/ # Git
+ rev = args
+ uri = URI("#{REDMINE_BASE}/projects/ruby-trunk/repository/ruby-git/revisions/#{rev}/issues.json")
+ else
+ raise CommandSyntaxError
+ end
unless @issue
puts "ticket not selected"
next
end
- rev = $1
- uri = URI("#{REDMINE_BASE}/projects/ruby-trunk/repository/trunk/revisions/#{rev}/issues.json")
+
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)
@@ -385,7 +395,7 @@ eom
if $!.respond_to?(:response) && $!.response.is_a?(Net::HTTPConflict)
$stderr.puts "the revision has already related to the ticket"
else
- $stderr.puts "deployed redmine doesn't have https://github.com/ruby/bugs.ruby-lang.org/commit/01fbba60d68cb916ddbccc8a8710e68c5217171d\nask naruse or hsbt"
+ $stderr.puts "#{$!.class}: #{$!.message}\n\ndeployed redmine doesn't have https://github.com/ruby/bugs.ruby-lang.org/commit/01fbba60d68cb916ddbccc8a8710e68c5217171d\nask naruse or hsbt"
end
next
end