[PATCH] expand paths to local repository or bundle in appropriate classes
Alexander Solovyov
piranha at piranha.org.ua
Mon Dec 7 04:31:54 CST 2009
# HG changeset patch
# User Alexander Solovyov <piranha at piranha.org.ua>
# Date 1260181905 -7200
# Node ID 4606d04e31d2f7737aff51460bccf9ea067d77e5
# Parent 253d0da256b2b4becf68cc2c5a877e41e6a19abe
expand paths to local repository or bundle in appropriate classes
This avoids problem with unexpanded paths when it's not possible to expand it at
higher level (for example, if file:~/path/ is supplied as path in schemes).
diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -164,7 +164,7 @@ class bundlerepository(localrepo.localre
localrepo.localrepository.__init__(self, ui, self._tempparent)
if path:
- self._url = 'bundle:' + path + '+' + bundlename
+ self._url = 'bundle:' + util.expandpath(path) + '+' + bundlename
else:
self._url = 'bundle:' + bundlename
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -15,8 +15,8 @@ import verify as _verify
import errno, os, shutil
def _local(path):
- return (os.path.isfile(util.drop_scheme('file', path)) and
- bundlerepo or localrepo)
+ path = util.expandpath(util.drop_scheme('file', path))
+ return (os.path.isfile(path) and bundlerepo or localrepo)
def parseurl(url, revs=[]):
'''parse url#branch, returning url, branch + revs'''
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -24,7 +24,7 @@ class localrepository(repo.repository):
def __init__(self, baseui, path=None, create=0):
repo.repository.__init__(self)
- self.root = os.path.realpath(path)
+ self.root = os.path.realpath(util.expandpath(path))
self.path = os.path.join(self.root, ".hg")
self.origroot = path
self.opener = util.opener(self.path)
More information about the Mercurial-devel
mailing list