diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-11-09 13:35:39 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-11-09 13:35:39 +0000 |
commit | 1ce82d510c60134cc8e2c53b41d15e19beeeced0 (patch) | |
tree | 52c06d5c463a9e25df4eaaf6834cffc8b0a31a24 /tool/vcs.rb | |
parent | ab60cf1a99607a0f679ed4aa44ad40d6af8fab19 (diff) | |
download | ruby-1ce82d510c60134cc8e2c53b41d15e19beeeced0.tar.gz |
rbinstall.rb: spec date from VCS
* tool/rbinstall.rb (Gem::Specification.load): obtain spec date from
VCS for the case using git, RUBY_RELEASE_DATE is the last resort.
probably fixes [Bug #9085].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43617 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/vcs.rb')
-rw-r--r-- | tool/vcs.rb | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/tool/vcs.rb b/tool/vcs.rb index e7cb610767..6e86cfb07e 100644 --- a/tool/vcs.rb +++ b/tool/vcs.rb @@ -1,5 +1,7 @@ # vcs +require 'time' + ENV.delete('PWD') unless File.respond_to? :realpath @@ -40,10 +42,11 @@ class VCS # +path+ was modified. def get_revisions(path) path = relative_to(path) - last, changed, *rest = Dir.chdir(@srcdir) {self.class.get_revisions(path)} + last, changed, modified, *rest = Dir.chdir(@srcdir) {self.class.get_revisions(path)} last or raise "last revision not found" changed or raise "changed revision not found" - return last, changed, *rest + modified &&= Time.parse(modified) + return last, changed, modified, *rest end def relative_to(path) @@ -84,7 +87,8 @@ class VCS end end _, last, _, changed, _ = info_xml.split(/revision="(\d+)"/) - [last, changed] + modified = info_xml[/<date>([^<>]*)/, 1] + [last, changed, modified] end end @@ -95,8 +99,14 @@ class VCS logcmd = %Q[git log -n1 --grep="^ *git-svn-id: .*@[0-9][0-9]* "] idpat = /git-svn-id: .*?@(\d+) \S+\Z/ last = `#{logcmd}`[idpat, 1] - changed = path ? `#{logcmd} "#{path}"`[idpat, 1] : last - [last, changed] + if path + log = `#{logcmd} "#{path}"` + changed = log[idpat, 1] + modified = `git log --format=%ai -- #{path}` + else + changed = last + end + [last, changed, modified] end end end |