diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-12-15 01:02:46 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-12-15 01:02:46 +0000 |
commit | 81ac745846986ae5fe22885342a6039e408e4e82 (patch) | |
tree | b352bde64825d43cfb29a635e313fa8d8e0b4fe9 /tool | |
parent | 36319b4f0ef49ba275cd93fe0cf52cf5202a6ce2 (diff) | |
download | ruby-81ac745846986ae5fe22885342a6039e408e4e82.tar.gz |
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
Diffstat (limited to 'tool')
-rw-r--r-- | tool/vcs.rb | 8 |
1 files changed, 5 insertions, 3 deletions
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}") |