ruby-changes:44581
From: nobu <ko1@a...>
Date: Mon, 7 Nov 2016 11:54:33 +0900 (JST)
Subject: [ruby-changes:44581] nobu:r56654 (trunk): vcs.rb: use chdir option
nobu 2016-11-07 11:54:27 +0900 (Mon, 07 Nov 2016) New Revision: 56654 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56654 Log: vcs.rb: use chdir option * tool/vcs.rb (export_changelog): for old git, use chdir option instead of git -C option, and set language environmets to C. Modified files: trunk/tool/vcs.rb Index: tool/vcs.rb =================================================================== --- tool/vcs.rb (revision 56653) +++ tool/vcs.rb (revision 56654) @@ -77,6 +77,16 @@ if RUBY_VERSION < "2.0" https://github.com/ruby/ruby/blob/trunk/tool/vcs.rb#L77 end end end +else + module DebugPOpen + refine IO.singleton_class do + def popen(*args) + STDERR.puts args.inspect if $DEBUG + super + end + end + end + using DebugPOpen end class VCS @@ -295,7 +305,8 @@ class VCS https://github.com/ruby/ruby/blob/trunk/tool/vcs.rb#L305 end def export_changelog(srcdir, url, from, to, path) - IO.popen({'TZ' => 'JST-9'}, "svn log -r#{to}:#{from} #{url}") do |r| + IO.popen({'TZ' => 'JST-9', 'LANG' => 'C', 'LC_ALL' => 'C'}, + %W"svn log -r#{to}:#{from} #{url}") do |r| open(path, 'w') do |w| IO.copy_stream(r, w) end @@ -378,9 +389,15 @@ class VCS https://github.com/ruby/ruby/blob/trunk/tool/vcs.rb#L389 end def export_changelog(srcdir, url, from, to, path) - from = `git -C #{srcdir} log -n1 --format=format:%H --grep='^ *git-svn-id: .*@#{from} '` - to = `git -C #{srcdir} log -n1 --format=format:%H --grep='^ *git-svn-id: .*@#{to} '` - IO.popen({'TZ' => 'JST-9'}, "git -C #{srcdir} log --date=iso-local --topo-order #{from}..#{to}") do |r| + from = IO.pread(%W"git log -n1 --format=format:%H" + + ["--grep=^ *git-svn-id: .*@#{from} "], + :chdir => srcdir) + to &&= IO.pread(%W"git log -n1 --format=format:%H" + + ["--grep=^ *git-svn-id: .*@#{to} "], + :chdir => srcdir) + IO.popen({'TZ' => 'JST-9', 'LANG' => 'C', 'LC_ALL' => 'C'}, + %W"git log --date=iso-local --topo-order #{from}..#{to}", + :chdir => srcdir) do |r| open(path, 'w') do |w| IO.copy_stream(r, w) end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/