1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
akr 2010-04-02 19:48:04 +00:00
parent 4b4dbeb93f
commit 8d8ff193b6
2 changed files with 21 additions and 1 deletions

View file

@ -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.

View file

@ -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