diff options
-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 |