diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-08-22 06:36:46 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-08-22 06:36:46 +0000 |
commit | f024d46f1155b0e9e6d767636f0ce8a9ca2efc65 (patch) | |
tree | 7dfdfa4aede4b96c1ff0360862df56b6647e641e /tool/vcs.rb | |
parent | 3229456d40be9219f1476855c945f84b9d30f00b (diff) | |
download | ruby-f024d46f1155b0e9e6d767636f0ce8a9ca2efc65.tar.gz |
tool/vcs.rb: no time.rb
* common.mk (Doxyfile): revert r43888, not to require preinstalled
ruby. [ruby-core:64488] [Bug #10161]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47248 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/vcs.rb')
-rw-r--r-- | tool/vcs.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/tool/vcs.rb b/tool/vcs.rb index 9a11ac4bf4..b3f3a31642 100644 --- a/tool/vcs.rb +++ b/tool/vcs.rb @@ -1,7 +1,5 @@ # vcs -require 'time' - ENV.delete('PWD') unless File.respond_to? :realpath @@ -61,7 +59,11 @@ class VCS } last or raise VCS::NotFoundError, "last revision not found" changed or raise VCS::NotFoundError, "changed revision not found" - modified &&= Time.parse(modified) + if modified + /\A(\d+)-(\d+)-(\d+)\D(\d+):(\d+):(\d+(?:\.\d+)?)\s*(?:Z|([-+]\d\d)(\d\d))\z/ =~ modified or + raise "unknown time format - #{modified}" + modified = Time.mktime(*($~[1..6] + [$7 ? "#{$7}:#{$8}" : "+00:00"])) + end return last, changed, modified, *rest end @@ -100,16 +102,16 @@ class VCS register(".git") def self.get_revisions(path) - logcmd = %Q[git log -n1 --grep="^ *git-svn-id: .*@[0-9][0-9]* "] + logcmd = %Q[git log -n1 --date=iso --grep="^ *git-svn-id: .*@[0-9][0-9]* "] idpat = /git-svn-id: .*?@(\d+) \S+\Z/ last = `#{logcmd}`[idpat, 1] if path log = `#{logcmd} "#{path}"` changed = log[idpat, 1] - modified = `git log --format=%ai -- #{path}` else changed = last end + modified = log[/^Date:\s+(.*)/, 1] [last, changed, modified] end end |