Mercurial > hg-stable
changeset 17157:87e8440964a0
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".
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Fri, 06 Jul 2012 18:45:27 +0900 |
parents | 7034365089bf |
children | 60338880d265 |
files | mercurial/localrepo.py mercurial/scmutil.py |
diffstat | 2 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/localrepo.py Fri Jul 06 18:45:26 2012 +0900 +++ b/mercurial/localrepo.py Fri Jul 06 18:45:27 2012 +0900 @@ -37,14 +37,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.
--- 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: