summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--tool/file2lastrev.rb16
2 files changed, 11 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 3b92ae78ee8..112c3f5c199 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Dec 23 15:36:58 2008 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * tool/file2lastrev.rb: detects vcs directory properly on building
+ outside of srcdir. [ruby-dev:37555] [ruby-dev:37561]
+
Tue Dec 23 15:30:02 2008 NAKAMURA Usaku <usa@ruby-lang.org>
* io.c (pipe_open): need to initialize args.
diff --git a/tool/file2lastrev.rb b/tool/file2lastrev.rb
index f8f14705743..430aca6730a 100644
--- a/tool/file2lastrev.rb
+++ b/tool/file2lastrev.rb
@@ -3,17 +3,13 @@
require 'optparse'
require 'pathname'
+SRCDIR = Pathname(File.dirname($0)).parent.freeze
class VCSNotFoundError < RuntimeError; end
def detect_vcs(path)
- target_path = Pathname(File.expand_path(path))
-
- path = target_path.directory? ? target_path : target_path.parent
- begin
- return :svn, target_path.relative_path_from(path) if File.directory?("#{path}/.svn")
- return :git, target_path.relative_path_from(path) if File.directory?("#{path}/.git")
- path, orig = path.parent, path
- end until path == orig
+ path = SRCDIR
+ return :svn, path.relative_path_from(SRCDIR) if File.directory?("#{path}/.svn")
+ return :git, path.relative_path_from(SRCDIR) if File.directory?("#{path}/.git")
raise VCSNotFoundError, "does not seem to be under a vcs"
end
@@ -23,9 +19,9 @@ def get_revisions(path)
info = case vcs
when :svn
- `svn info #{path}`
+ `cd '#{SRCDIR}' && svn info '#{path}'`
when :git
- `git svn info #{path}`
+ `cd '#{SRCDIR}' && git svn info '#{path}'`
end
if info =~ /^Revision: (\d+)$/