ruby-changes:44597
From: nobu <ko1@a...>
Date: Tue, 8 Nov 2016 16:47:27 +0900 (JST)
Subject: [ruby-changes:44597] nobu:r56670 (trunk): vcs.rb: format from git-log
nobu 2016-11-08 16:47:23 +0900 (Tue, 08 Nov 2016) New Revision: 56670 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56670 Log: 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. Modified files: trunk/tool/vcs.rb Index: tool/vcs.rb =================================================================== --- tool/vcs.rb (revision 56669) +++ tool/vcs.rb (revision 56670) @@ -1,5 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/tool/vcs.rb#L1 # 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 https://github.com/ruby/ruby/blob/trunk/tool/vcs.rb#L434 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/