From 81ac745846986ae5fe22885342a6039e408e4e82 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 15 Dec 2014 01:02:46 +0000 Subject: vcs.rb: non-string path * tool/vcs.rb (VCS#get_revisions, VCS::SVN.get_revisions): allow path to be other than a string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48839 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- tool/vcs.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'tool') diff --git a/tool/vcs.rb b/tool/vcs.rb index 430a130b80..e0ae64c3fe 100644 --- a/tool/vcs.rb +++ b/tool/vcs.rb @@ -71,7 +71,9 @@ class VCS # return a pair of strings, the last revision and the last revision in which # +path+ was modified. def get_revisions(path) - path = relative_to(path) + if String === path or path.respond_to?(:to_path) + path = relative_to(path) + end last, changed, modified, *rest = ( begin if NullDevice @@ -103,7 +105,7 @@ class VCS def relative_to(path) if path srcdir = File.realpath(@srcdir) - path = File.realpath(path) + path = File.realdirpath(path) list1 = srcdir.split(%r{/}) list2 = path.split(%r{/}) while !list1.empty? && !list2.empty? && list1.first == list2.first @@ -124,7 +126,7 @@ class VCS register(".svn") def self.get_revisions(path, srcdir = nil) - if srcdir and %r'\A(?:[^/]+:|/)' !~ path + if srcdir and (String === path or path.respond_to?(:to_path)) path = File.join(srcdir, path) end info_xml = IO.pread(%W"svn info --xml #{path}") -- cgit v1.2.3