vfs: define "join()" in each classes derived from "abstractvfs"
authorFUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Tue, 09 Oct 2012 01:41:55 +0900
changeset 17725 ffd589d4b785
parent 17724 bf4b72d8dd4d
child 17726 7cb7e17c23b2
vfs: define "join()" in each classes derived from "abstractvfs" This patch defines "join()" in each classes derived from "abstractvfs" except "vfs", which already defines it. This allows all vfs instances to be used for indirect file API invocation.
mercurial/scmutil.py
mercurial/statichttprepo.py
mercurial/store.py
--- a/mercurial/scmutil.py	Tue Oct 09 01:41:55 2012 +0900
+++ b/mercurial/scmutil.py	Tue Oct 09 01:41:55 2012 +0900
@@ -347,6 +347,12 @@
     def __call__(self, path, *args, **kwargs):
         return self._orig(self._filter(path), *args, **kwargs)
 
+    def join(self, path):
+        if path:
+            return self._orig.join(self._filter(path))
+        else:
+            return self._orig.join(path)
+
 filteropener = filtervfs
 
 def canonpath(root, cwd, myname, auditor=None):
--- a/mercurial/statichttprepo.py	Tue Oct 09 01:41:55 2012 +0900
+++ b/mercurial/statichttprepo.py	Tue Oct 09 01:41:55 2012 +0900
@@ -74,6 +74,12 @@
             f = "/".join((self.base, urllib.quote(path)))
             return httprangereader(f, urlopener)
 
+        def join(self, path):
+            if path:
+                return os.path.join(self.base, path)
+            else:
+                return self.base
+
     return statichttpvfs
 
 class statichttppeer(localrepo.localpeer):
--- a/mercurial/store.py	Tue Oct 09 01:41:55 2012 +0900
+++ b/mercurial/store.py	Tue Oct 09 01:41:55 2012 +0900
@@ -441,6 +441,12 @@
             self.fncache.add(path)
         return self.vfs(self.encode(path), mode, *args, **kw)
 
+    def join(self, path):
+        if path:
+            return self.vfs.join(self.encode(path))
+        else:
+            return self.vfs.join(path)
+
 class fncachestore(basicstore):
     def __init__(self, path, vfstype, dotencode):
         if dotencode: