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:
parent
5d24fba544
commit
4d8ad48f7d
1 changed files with 16 additions and 3 deletions
|
@ -9,6 +9,7 @@ require 'strscan'
|
||||||
require 'optparse'
|
require 'optparse'
|
||||||
require 'abbrev'
|
require 'abbrev'
|
||||||
require 'pp'
|
require 'pp'
|
||||||
|
require 'shellwords'
|
||||||
begin
|
begin
|
||||||
require 'readline'
|
require 'readline'
|
||||||
rescue LoadError
|
rescue LoadError
|
||||||
|
@ -239,6 +240,10 @@ def find_svn_log(pattern)
|
||||||
`svn log --xml --stop-on-copy --search="#{pattern}" #{RUBY_REPO_PATH}`
|
`svn log --xml --stop-on-copy --search="#{pattern}" #{RUBY_REPO_PATH}`
|
||||||
end
|
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)
|
def show_last_journal(http, uri)
|
||||||
res = http.get("#{uri.path}?include=journals")
|
res = http.get("#{uri.path}?include=journals")
|
||||||
res.value
|
res.value
|
||||||
|
@ -431,11 +436,19 @@ eom
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
log = find_svn_log("##@issue]")
|
if system("svn info #{RUBY_REPO_PATH&.shellescape} > /dev/null 2>&1") # SVN
|
||||||
if log && /revision="(?<rev>\d+)/ =~ log
|
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 = log[/merge revision\(s\) ([^:]+)(?=:)/]
|
||||||
str.insert(5, "d")
|
str.insert(5, "d")
|
||||||
str = "ruby_#{TARGET_VERSION.tr('.','_')} r#{rev} #{str}."
|
str = "ruby_#{TARGET_VERSION.tr('.','_')} #{rev} #{str}."
|
||||||
if notes
|
if notes
|
||||||
str << "\n"
|
str << "\n"
|
||||||
str << notes
|
str << notes
|
||||||
|
|
Loading…
Add table
Reference in a new issue