[PATCH 2 of 5 STABLE] scmutil: add join method to opener to construct path relative to base

Idan Kamara idankk86 at gmail.com
Tue Feb 28 09:53:33 CST 2012


# HG changeset patch
# User Idan Kamara <idankk86 at gmail.com>
# Date 1330444189 -7200
# Branch stable
# Node ID 7b3a99ee65dc51231a484e9db216904c5fa0b49a
# Parent  94da74854f8123af5f81c1a996352fdaeffb23d5
scmutil: add join method to opener to construct path relative to base

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -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.'''
 


More information about the Mercurial-devel mailing list