summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--common.mk2
-rwxr-xr-xtool/file2lastrev.rb7
-rw-r--r--tool/vcs.rb12
4 files changed, 19 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 5f476c7..0ad151a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Aug 22 15:36:09 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (Doxyfile): revert r43888, not to require preinstalled
+ ruby. [ruby-core:64488] [Bug #10161]
+
Fri Aug 22 12:32:15 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
* lib/shell.rb: removed commented-out code.
diff --git a/common.mk b/common.mk
index 8419314..3b79180 100644
--- a/common.mk
+++ b/common.mk
@@ -204,7 +204,7 @@ $(CAPIOUT)/.timestamp: Doxyfile $(PREP)
Doxyfile: $(srcdir)/template/Doxyfile.tmpl $(PREP) $(srcdir)/tool/generic_erb.rb $(RBCONFIG)
$(ECHO) generating $@
$(Q) $(MINIRUBY) $(srcdir)/tool/generic_erb.rb -o $@ $(srcdir)/template/Doxyfile.tmpl \
- --srcdir="$(srcdir)" --miniruby="$(BASERUBY)"
+ --srcdir="$(srcdir)" --miniruby="$(MINIRUBY)"
program: showflags $(PROGRAM)
wprogram: showflags $(WPROGRAM)
diff --git a/tool/file2lastrev.rb b/tool/file2lastrev.rb
index 56e1b9f..616c5f7 100755
--- a/tool/file2lastrev.rb
+++ b/tool/file2lastrev.rb
@@ -31,6 +31,9 @@ parser = OptionParser.new {|opts|
opts.on("--doxygen", "Doxygen format") do
self.output = :doxygen
end
+ opts.on("--modified", "modified time") do
+ self.output = :modified
+ end
opts.on("-q", "--suppress_not_found") do
@suppress_not_found = true
end
@@ -44,7 +47,7 @@ rescue VCS::NotFoundError => e
abort "#{File.basename(Program)}: #{e.message}" unless @suppress_not_found
else
begin
- last, changed = vcs.get_revisions(ARGV.shift)
+ last, changed, modified = vcs.get_revisions(ARGV.shift)
rescue => e
abort "#{File.basename(Program)}: #{e.message}" unless @suppress_not_found
exit false
@@ -58,6 +61,8 @@ when :revision_h
puts "#define RUBY_REVISION #{changed.to_i}"
when :doxygen
puts "r#{changed}/r#{last}"
+when :modified
+ puts modified.strftime('%Y-%m-%dT%H:%M:%S%z')
else
raise "unknown output format `#{@output}'"
end
diff --git a/tool/vcs.rb b/tool/vcs.rb
index 9a11ac4..b3f3a31 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