summaryrefslogtreecommitdiff
path: root/tool/file2lastrev.rb
diff options
context:
space:
mode:
Diffstat (limited to 'tool/file2lastrev.rb')
-rwxr-xr-xtool/file2lastrev.rb17
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