vcs.rb: added base_url
keyword option to GIT#export_changelog
This commit is contained in:
parent
ced09d521c
commit
a0faad38ce
@ -525,7 +525,7 @@ class VCS
|
|||||||
#{url.to_str} -- version.h include/ruby/version.h])
|
#{url.to_str} -- version.h include/ruby/version.h])
|
||||||
end
|
end
|
||||||
|
|
||||||
def export_changelog(url = '@', from = nil, to = nil, _path = nil, path: _path)
|
def export_changelog(url = '@', from = nil, to = nil, _path = nil, path: _path, base_url: nil)
|
||||||
svn = nil
|
svn = nil
|
||||||
from, to = [from, to].map do |rev|
|
from, to = [from, to].map do |rev|
|
||||||
rev or next
|
rev or next
|
||||||
@ -558,7 +558,17 @@ class VCS
|
|||||||
if svn
|
if svn
|
||||||
format_changelog_as_svn(path, arg)
|
format_changelog_as_svn(path, arg)
|
||||||
else
|
else
|
||||||
format_changelog(path, arg)
|
if base_url == true
|
||||||
|
remote, = upstream
|
||||||
|
if remote &&= cmd_read(env, %W[#{COMMAND} remote get-url --no-push #{remote}])
|
||||||
|
remote.chomp!
|
||||||
|
# hack to redirect git.r-l.o to github
|
||||||
|
remote.sub!(/\Agit@git\.ruby-lang\.org:/, 'git@github.com:ruby/')
|
||||||
|
remote.sub!(/\Agit@(.*?):(.*?)(?:\.git)?\z/, 'https://\1/\2/commit/')
|
||||||
|
end
|
||||||
|
base_url = remote
|
||||||
|
end
|
||||||
|
format_changelog(path, arg, base_url)
|
||||||
end
|
end
|
||||||
if !path or path == '-'
|
if !path or path == '-'
|
||||||
writer[$stdout]
|
writer[$stdout]
|
||||||
@ -567,7 +577,7 @@ class VCS
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def format_changelog(path, arg)
|
def format_changelog(path, arg, base_url = nil)
|
||||||
env = {'TZ' => 'JST-9', 'LANG' => 'C', 'LC_ALL' => 'C'}
|
env = {'TZ' => 'JST-9', 'LANG' => 'C', 'LC_ALL' => 'C'}
|
||||||
cmd = %W"#{COMMAND} log --format=fuller --notes=commits --notes=log-fix --topo-order --no-merges"
|
cmd = %W"#{COMMAND} log --format=fuller --notes=commits --notes=log-fix --topo-order --no-merges"
|
||||||
date = "--date=iso-local"
|
date = "--date=iso-local"
|
||||||
@ -578,6 +588,7 @@ class VCS
|
|||||||
cmd.concat(arg)
|
cmd.concat(arg)
|
||||||
proc do |w|
|
proc do |w|
|
||||||
w.print "-*- coding: utf-8 -*-\n\n"
|
w.print "-*- coding: utf-8 -*-\n\n"
|
||||||
|
w.print "base-url = #{base_url}\n\n" if base_url
|
||||||
cmd_pipe(env, cmd, chdir: @srcdir) do |r|
|
cmd_pipe(env, cmd, chdir: @srcdir) do |r|
|
||||||
while s = r.gets("\ncommit ")
|
while s = r.gets("\ncommit ")
|
||||||
h, s = s.split(/^$/, 2)
|
h, s = s.split(/^$/, 2)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user