[PATCH 1 of 8] vfs: split "expand" into "realpath"/"expandpath" to apply each separately

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Sun Apr 14 12:23:10 CDT 2013


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1365956535 -32400
# Node ID da2aae2ce567c5f8c65dcca1e2c1cf9319ee0fa0
# Parent  4e1ae55e63ef13bbee13256f236d93efe817be69
vfs: split "expand" into "realpath"/"expandpath" to apply each separately

Before this patch, vfs constructor applies both "util.expandpath()"
and "os.path.realpath()" on "base" path, if "expand" is True.

This patch splits it into "realpath" and "expandpath", to apply each
functions separately: this splitting can allow to use vfs also where
one of each is not needed.

diff -r 4e1ae55e63ef -r da2aae2ce567 mercurial/localrepo.py
--- a/mercurial/localrepo.py	Fri Apr 12 17:00:42 2013 -0400
+++ b/mercurial/localrepo.py	Mon Apr 15 01:22:15 2013 +0900
@@ -153,7 +153,7 @@
         return self.requirements[:]
 
     def __init__(self, baseui, path=None, create=False):
-        self.wvfs = scmutil.vfs(path, expand=True)
+        self.wvfs = scmutil.vfs(path, expandpath=True, realpath=True)
         self.wopener = self.wvfs
         self.root = self.wvfs.base
         self.path = self.wvfs.join(".hg")
diff -r 4e1ae55e63ef -r da2aae2ce567 mercurial/scmutil.py
--- a/mercurial/scmutil.py	Fri Apr 12 17:00:42 2013 -0400
+++ b/mercurial/scmutil.py	Mon Apr 15 01:22:15 2013 +0900
@@ -263,9 +263,11 @@
     This class is used to hide the details of COW semantics and
     remote file access from higher level code.
     '''
-    def __init__(self, base, audit=True, expand=False):
-        if expand:
-            base = os.path.realpath(util.expandpath(base))
+    def __init__(self, base, audit=True, expandpath=False, realpath=False):
+        if expandpath:
+            base = util.expandpath(base)
+        if realpath:
+            base = os.path.realpath(base)
         self.base = base
         self._setmustaudit(audit)
         self.createmode = None


More information about the Mercurial-devel mailing list