Assign the result of format_changelog
to the changelog writer
Also, rename `format_changelog` to `changelog_formatter` since this method does not format the changelog when called, but rather returns a Proc that takes IO and writes the formatted changelog.
This commit is contained in:
parent
888820c581
commit
4e6946bda7
@ -489,7 +489,6 @@ class VCS
|
|||||||
else
|
else
|
||||||
arg = ["--since=25 Dec 00:00:00", to]
|
arg = ["--since=25 Dec 00:00:00", to]
|
||||||
end
|
end
|
||||||
writer =
|
|
||||||
if base_url == true
|
if base_url == true
|
||||||
remote, = upstream
|
remote, = upstream
|
||||||
if remote &&= cmd_read(env, %W[#{COMMAND} remote get-url --no-push #{remote}])
|
if remote &&= cmd_read(env, %W[#{COMMAND} remote get-url --no-push #{remote}])
|
||||||
@ -500,7 +499,7 @@ class VCS
|
|||||||
end
|
end
|
||||||
base_url = remote
|
base_url = remote
|
||||||
end
|
end
|
||||||
format_changelog(path, arg, base_url)
|
writer = changelog_formatter(path, arg, base_url)
|
||||||
if !path or path == '-'
|
if !path or path == '-'
|
||||||
writer[$stdout]
|
writer[$stdout]
|
||||||
else
|
else
|
||||||
@ -510,7 +509,7 @@ class VCS
|
|||||||
|
|
||||||
LOG_FIX_REGEXP_SEPARATORS = '/!:;|,#%&'
|
LOG_FIX_REGEXP_SEPARATORS = '/!:;|,#%&'
|
||||||
|
|
||||||
def format_changelog(path, arg, base_url = nil)
|
def changelog_formatter(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
|
cmd = %W[#{COMMAND} log
|
||||||
--format=fuller --notes=commits --notes=log-fix --topo-order --no-merges
|
--format=fuller --notes=commits --notes=log-fix --topo-order --no-merges
|
||||||
@ -570,7 +569,7 @@ class VCS
|
|||||||
next
|
next
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
message = ["format_changelog failed to replace #{wrong.dump} with #{correct.dump} at #{n}\n"]
|
message = ["changelog_formatter failed to replace #{wrong.dump} with #{correct.dump} at #{n}\n"]
|
||||||
from = [1, n-2].max
|
from = [1, n-2].max
|
||||||
to = [s.size-1, n+2].min
|
to = [s.size-1, n+2].min
|
||||||
s.each_with_index do |e, i|
|
s.each_with_index do |e, i|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user