1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
k0kubun 2019-04-21 14:24:38 +00:00
parent c7db05d216
commit b6fd7b1bb7

View file

@ -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