1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2016-11-08 07:47:23 +00:00
parent 27831204e1
commit ad80c47aca

View file

@ -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