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

Fix typo in commit logs by log-fix notes

This commit is contained in:
Nobuyoshi Nakada 2019-12-23 08:42:53 +09:00
parent 4de2297d74
commit 80d5d220b9
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60

View file

@ -613,6 +613,8 @@ class VCS
chdir: @srcdir, exception: false)
abort "Could not fetch notes/commits tree"
end
system(*%W"#{COMMAND} fetch origin refs/notes/log-fix:refs/notes/log-fix",
chdir: @srcdir, exception: false)
to ||= url.to_str
if from
arg = ["#{from}^..#{to}"]
@ -628,14 +630,32 @@ class VCS
def format_changelog(path, arg)
env = {'TZ' => 'JST-9', 'LANG' => 'C', 'LC_ALL' => 'C'}
cmd = %W"#{COMMAND} log --format=medium --notes=commits --topo-order --no-merges"
cmd = %W"#{COMMAND} log --format=medium --notes=commits --notes=log-fix --topo-order --no-merges"
date = "--date=iso-local"
unless system(env, *cmd, date, chdir: @srcdir, out: NullDevice, exception: false)
date = "--date=iso"
end
cmd << date
cmd.concat(arg)
system(env, *cmd, chdir: @srcdir, out: path)
File.open(path, 'w') do |w|
cmd_pipe(env, cmd, chdir: @srcdir) do |r|
while s = r.gets("\ncommit ")
if s.sub!(/\nNotes \(log-fix\):\n((?: +.*\n)+)/, '')
fix = $1
h, s = s.split(/^$/, 2)
s = s.lines
fix.each_line do |x|
if %r[^ +(\d+)s/(.+)/(.+)/] =~ x
s[$1.to_i][$2] = $3
end
end
s = [h, s.join('')].join('')
end
s.gsub!(/ +\n/, "\n")
w.print s
end
end
end
end
def format_changelog_as_svn(path, arg)