summaryrefslogtreecommitdiff
path: root/tool/file2lastrev.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-04-02 19:48:04 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-04-02 19:48:04 +0000
commit8d8ff193b6db072ebe379d60f91e0baa17090a2c (patch)
treecead35008409333087d01fb4c109b0c76a6b383d /tool/file2lastrev.rb
parent4b4dbeb93fa1649894c5c76154deb55be815e957 (diff)
* tool/file2lastrev.rb (VCS#relative_to): path and @srcdir may have
different relative-ness. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/file2lastrev.rb')
-rwxr-xr-xtool/file2lastrev.rb17
1 files changed, 16 insertions, 1 deletions
diff --git a/tool/file2lastrev.rb b/tool/file2lastrev.rb
index 53774d6..cf15389 100755
--- a/tool/file2lastrev.rb
+++ b/tool/file2lastrev.rb
@@ -38,7 +38,22 @@ class VCS
end
def relative_to(path)
- path ? Pathname(path).relative_path_from(@srcdir) : '.'
+ if path
+ path = Pathname(path)
+ srcdir = @srcdir
+ if path.absolute? ^ srcdir.absolute?
+ if path.absolute?
+ srcdir = srcdir.expand_path
+ end
+ else
+ if srcdir.absolute?
+ path = path.expand_path
+ end
+ end
+ path.relative_path_from(srcdir)
+ else
+ '.'
+ end
end
class SVN < self