ruby-changes:15312
From: akr <ko1@a...>
Date: Sat, 3 Apr 2010 04:49:47 +0900 (JST)
Subject: [ruby-changes:15312] Ruby:r27199 (trunk): * tool/file2lastrev.rb (VCS#relative_to): path and @srcdir may have
akr 2010-04-03 04:48:04 +0900 (Sat, 03 Apr 2010) New Revision: 27199 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=27199 Log: * tool/file2lastrev.rb (VCS#relative_to): path and @srcdir may have different relative-ness. Modified files: trunk/ChangeLog trunk/tool/file2lastrev.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 27198) +++ ChangeLog (revision 27199) @@ -1,3 +1,8 @@ +Sat Apr 3 04:46:00 2010 Tanaka Akira <akr@f...> + + * tool/file2lastrev.rb (VCS#relative_to): path and @srcdir may have + different relative-ness. + Sat Apr 3 03:19:01 2010 Kazuhiro NISHIYAMA <zn@m...> * lib/benchmark.rb (Benchmark::Tms#add): fix NameError. Index: tool/file2lastrev.rb =================================================================== --- tool/file2lastrev.rb (revision 27198) +++ tool/file2lastrev.rb (revision 27199) @@ -38,7 +38,22 @@ 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/