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

Support git as redmine-backporter's done destination

This commit is contained in:
Takashi Kokubun 2019-04-28 19:33:41 +09:00
parent 5d24fba544
commit 4d8ad48f7d
No known key found for this signature in database
GPG key ID: 6FFC433B12EE23DD

View file

@ -9,6 +9,7 @@ require 'strscan'
require 'optparse'
require 'abbrev'
require 'pp'
require 'shellwords'
begin
require 'readline'
rescue LoadError
@ -239,6 +240,10 @@ def find_svn_log(pattern)
`svn log --xml --stop-on-copy --search="#{pattern}" #{RUBY_REPO_PATH}`
end
def find_git_log(pattern)
`git #{RUBY_REPO_PATH ? "-C #{RUBY_REPO_PATH.shellecape}" : ""} log --grep="#{pattern}"`
end
def show_last_journal(http, uri)
res = http.get("#{uri.path}?include=journals")
res.value
@ -431,11 +436,19 @@ eom
next
end
log = find_svn_log("##@issue]")
if log && /revision="(?<rev>\d+)/ =~ log
if system("svn info #{RUBY_REPO_PATH&.shellescape} > /dev/null 2>&1") # SVN
if log = find_svn_log("##@issue]") && /revision="(?<rev>\d+)/ =~ log
rev = "r#{rev}"
end
else # Git
if log = find_git_log("##@issue]")
/^commit (?<rev>\h{40})$/ =~ log
end
end
if log && rev
str = log[/merge revision\(s\) ([^:]+)(?=:)/]
str.insert(5, "d")
str = "ruby_#{TARGET_VERSION.tr('.','_')} r#{rev} #{str}."
str = "ruby_#{TARGET_VERSION.tr('.','_')} #{rev} #{str}."
if notes
str << "\n"
str << notes