[PATCH 2 of 3 RFC] vfs: use path expansion API via vfs for field initialization of localrepository

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Thu Jun 21 05:47:09 CDT 2012


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1340275263 -32400
# Node ID 72404f12faa06fdc477324d90c84b854a97c7cc8
# Parent  11873b223a9ce8e7486f5da3db7b534acb1eae32
vfs: use path expansion API via vfs for field initialization of localrepository

diff -r 11873b223a9c -r 72404f12faa0 mercurial/localrepo.py
--- a/mercurial/localrepo.py	Thu Jun 21 19:41:03 2012 +0900
+++ b/mercurial/localrepo.py	Thu Jun 21 19:41:03 2012 +0900
@@ -33,14 +33,14 @@
 
     def __init__(self, baseui, path=None, create=False):
         repo.repository.__init__(self)
-        self.root = os.path.realpath(util.expandpath(path))
+        self.wopener = scmutil.opener(path, expand=True)
+        self.wvfs = self.wopener
+        self.root = self.wvfs.base
         self.path = os.path.join(self.root, ".hg")
         self.origroot = path
         self.auditor = scmutil.pathauditor(self.root, self._checknested)
         self.opener = scmutil.opener(self.path)
         self.vfs = self.opener
-        self.wopener = scmutil.opener(self.root)
-        self.wvfs = self.wopener
         self.baseui = baseui
         self.ui = baseui.copy()
         # A list of callback to shape the phase if no data were found.
diff -r 11873b223a9c -r 72404f12faa0 mercurial/scmutil.py
--- a/mercurial/scmutil.py	Thu Jun 21 19:41:03 2012 +0900
+++ b/mercurial/scmutil.py	Thu Jun 21 19:41:03 2012 +0900
@@ -196,7 +196,9 @@
     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):
+    def __init__(self, base, audit=True, expand=False):
+        if expand:
+            base = os.path.realpath(util.expandpath(base))
         self.base = base
         self._audit = audit
         if audit:


More information about the Mercurial-devel mailing list