aboutsummaryrefslogtreecommitdiffstats
path: root/tool/vcs.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-08 07:47:23 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-08 07:47:23 +0000
commit462f190ef5c44c5eeed6eead015167d81b79659b (patch)
tree6883a932dfbd318d1641e65faaa8b8d682158d31 /tool/vcs.rb
parentb3d19ea4349ece839fbd8f8ce007782195f96c82 (diff)
downloadruby-462f190ef5c44c5eeed6eead015167d81b79659b.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
Diffstat (limited to 'tool/vcs.rb')
-rw-r--r--tool/vcs.rb18
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