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 | |
parent | 4b4dbeb93fa1649894c5c76154deb55be815e957 (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
-rw-r--r-- | ChangeLog | 5 | ||||
-rwxr-xr-x | tool/file2lastrev.rb | 17 |
2 files changed, 21 insertions, 1 deletions
@@ -1,3 +1,8 @@ +Sat Apr 3 04:46:00 2010 Tanaka Akira <akr@fsij.org> + + * tool/file2lastrev.rb (VCS#relative_to): path and @srcdir may have + different relative-ness. + Sat Apr 3 03:19:01 2010 Kazuhiro NISHIYAMA <zn@mbf.nifty.com> * lib/benchmark.rb (Benchmark::Tms#add): fix NameError. 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 |