changeset 16199:8181bd808dc5 stable

scmutil: add join method to opener to construct path relative to base Useful when we only have the opener without the base path used when it was constructed.
author Idan Kamara <idankk86@gmail.com>
date Thu, 01 Mar 2012 17:39:58 +0200
parents fa8488565afd
children 9d4a2942a732
files mercurial/scmutil.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/scmutil.py	Thu Mar 01 17:39:58 2012 +0200
+++ b/mercurial/scmutil.py	Thu Mar 01 17:39:58 2012 +0200
@@ -211,7 +211,7 @@
             if r:
                 raise util.Abort("%s: %r" % (r, path))
         self.auditor(path)
-        f = os.path.join(self.base, path)
+        f = self.join(path)
 
         if not text and "b" not in mode:
             mode += "b" # for that other OS
@@ -255,7 +255,7 @@
 
     def symlink(self, src, dst):
         self.auditor(dst)
-        linkname = os.path.join(self.base, dst)
+        linkname = self.join(dst)
         try:
             os.unlink(linkname)
         except OSError:
@@ -280,6 +280,9 @@
     def audit(self, path):
         self.auditor(path)
 
+    def join(self, path):
+        return os.path.join(self.base, path)
+
 class filteropener(abstractopener):
     '''Wrapper opener for filtering filenames with a function.'''