diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-08 07:47:23 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-08 07:47:23 +0000 |
commit | ad80c47acaaf5cdf095b4ba9a266cc90bb8686de (patch) | |
tree | 6883a932dfbd318d1641e65faaa8b8d682158d31 | |
parent | 27831204e1c9a2e31ebfed6eb90fbaa9d6039367 (diff) | |
download | ruby-ad80c47acaaf5cdf095b4ba9a266cc90bb8686de.tar.gz |
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
-rw-r--r-- | tool/vcs.rb | 18 |
1 files 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 |