From ad80c47acaaf5cdf095b4ba9a266cc90bb8686de Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 8 Nov 2016 07:47:23 +0000 Subject: vcs.rb: format from git-log * tool/vcs.rb (VCS::GIT#export_changelog): re-format from git-log to svn style log, instead of git-svn, because cloned working directory would not have .git/svn. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- tool/vcs.rb | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/tool/vcs.rb b/tool/vcs.rb index ba8be9044a..9b8e417032 100644 --- a/tool/vcs.rb +++ b/tool/vcs.rb @@ -1,5 +1,6 @@ # vcs require 'fileutils' +require 'time' # This library is used by several other tools/ scripts to detect the current # VCS in use (e.g. SVN, Git) or to interact with that VCS. @@ -433,9 +434,22 @@ class VCS rev unless rev.empty? end.join('..') cmd_pipe({'TZ' => 'JST-9', 'LANG' => 'C', 'LC_ALL' => 'C'}, - %W"git svn log --date=iso-local --topo-order #{range}") do |r| + %W"git log --date=iso-local --topo-order #{range}") do |r| open(path, 'w') do |w| - IO.copy_stream(r, w) + sep = "-"*72 + w.puts sep + while s = r.gets('') + author = s[/^Author:\s*(\S+)/, 1] + time = s[/^Date:\s*(.+)/, 1] + s = r.gets('') + s.gsub!(/^ {4}/, '') + s.sub!(/^git-svn-id: .*@(\d+) .*\n+\z/, '') + rev = $1 + s.gsub!(/^ {8}/, '') if /^(?! {8}|$)/ !~ s + date = Time.strptime(time, "%Y-%m-%d %T %z").strftime("%a, %d %b %y") + w.puts "r#{rev} | #{author} | #{time} (#{date}) | #{s.count("\n")} lines\n\n" + w.puts s, sep + end end end end -- cgit v1.2.3