diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-02 19:48:04 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-02 19:48:04 +0000 |
commit | 8d8ff193b6db072ebe379d60f91e0baa17090a2c (patch) | |
tree | cead35008409333087d01fb4c109b0c76a6b383d /tool/file2lastrev.rb | |
parent | 4b4dbeb93fa1649894c5c76154deb55be815e957 (diff) | |
download | ruby-8d8ff193b6db072ebe379d60f91e0baa17090a2c.tar.gz |
* 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-x | tool/file2lastrev.rb | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tool/file2lastrev.rb b/tool/file2lastrev.rb index 53774d6d34..cf15389112 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 |