summaryrefslogtreecommitdiff
path: root/tool/vcs.rb
diff options
context:
space:
mode:
Diffstat (limited to 'tool/vcs.rb')
-rw-r--r--tool/vcs.rb12
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