From 867d39855863e53c84bc528537202d981f812997 Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 25 Nov 2018 08:32:52 +0000 Subject: [PATCH] ChangeLog compatibility [ci skip] * tool/vcs.rb (VCS::GIT#export_changelog): improve the compatibility with svn-log. remained differences are: - in svn-log - accented characters, left/right single quotation marks, and non-break spaces are translated to ASCII characters - other non-ASCII characters are excoded as `{U+XXXX}` - in git-log - tabs are expanded - in git-log (intentional) - lines looking too indented are unindented - empty lines between headers and bodies are squeezed git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- tool/vcs.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tool/vcs.rb b/tool/vcs.rb index 128dfe592e..ca9c8964b5 100644 --- a/tool/vcs.rb +++ b/tool/vcs.rb @@ -480,10 +480,13 @@ class VCS s.sub!(/^git-svn-id: .*@(\d+) .*\n+\z/, '') rev = $1 s.gsub!(/^ {8}/, '') if /^(?! {8}|$)/ !~ s + s.sub!(/\n\n\z/, "\n") if /\A(\d+)-(\d+)-(\d+)/ =~ time date = Time.new($1.to_i, $2.to_i, $3.to_i).strftime("%a, %d %b %Y") end - w.puts "r#{rev} | #{author} | #{time} (#{date}) | #{s.count("\n")} lines\n\n" + lines = s.count("\n") + lines = "#{lines} line#{lines == 1 ? '' : 's'}" + w.puts "r#{rev} | #{author} | #{time} (#{date}) | #{lines}\n\n" w.puts s, sep end end