mercurial/scmutil.py
changeset 16208 85db991780b7
parent 16171 336e61875335
parent 16199 8181bd808dc5
child 16379 5cbfbb838198
--- a/mercurial/scmutil.py	Thu Mar 01 17:45:13 2012 +0100
+++ b/mercurial/scmutil.py	Fri Mar 02 09:57:09 2012 +0100
@@ -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.'''
 
@@ -804,9 +807,17 @@
     to tell us if a file has been replaced. If it can't, we fallback to
     recreating the object on every call (essentially the same behaviour as
     propertycache).'''
-    def __init__(self, path, instore=False):
+    def __init__(self, path):
         self.path = path
-        self.instore = instore
+
+    def join(self, obj, fname):
+        """Used to compute the runtime path of the cached file.
+
+        Users should subclass filecache and provide their own version of this
+        function to call the appropriate join function on 'obj' (an instance
+        of the class that its member function was decorated).
+        """
+        return obj.join(fname)
 
     def __call__(self, func):
         self.func = func
@@ -824,7 +835,7 @@
             if entry.changed():
                 entry.obj = self.func(obj)
         else:
-            path = self.instore and obj.sjoin(self.path) or obj.join(self.path)
+            path = self.join(obj, self.path)
 
             # We stat -before- creating the object so our cache doesn't lie if
             # a writer modified between the time we read and stat