[PATCH 2 of 6 V2] localrepo: use path expansion API via vfs
FUJIWARA Katsunori
foozy at lares.dti.ne.jp
Fri Jul 6 04:45:38 CDT 2012
# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1341567927 -32400
# Node ID 2560b3080d3188c18430f0894ba04fd5a5159dda
# Parent df1f9c100827e00c6fe1bbf309bf8dc704136d26
localrepo: use path expansion API via vfs
As a part of migration to vfs, this patch moves path expansion API
invocations in the constructor of "localrepository" to the constructor
of "opener", because the root path to the repository is very important
to handle paths using non-ASCII characters correctly.
This patch also rearrange initialization order of "wvfs" field,
because it is required to initialize "self.root".
diff -r df1f9c100827 -r 2560b3080d31 mercurial/localrepo.py
--- a/mercurial/localrepo.py Fri Jul 06 18:45:26 2012 +0900
+++ b/mercurial/localrepo.py Fri Jul 06 18:45:27 2012 +0900
@@ -32,14 +32,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 df1f9c100827 -r 2560b3080d31 mercurial/scmutil.py
--- a/mercurial/scmutil.py Fri Jul 06 18:45:26 2012 +0900
+++ b/mercurial/scmutil.py Fri Jul 06 18:45:27 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