[PATCH] expand paths to local repository or bundle in appropriate classes
Alexander Solovyov
piranha at piranha.org.ua
Sun May 2 06:22:17 CDT 2010
# HG changeset patch
# User Alexander Solovyov <piranha at piranha.org.ua>
# Date 1260181905 -7200
# Node ID cd71f6766dfe7cb8425a90a33b65361770301aba
# Parent 1f5713f503be27a28a3dcb0e7b0ba4bc00eae6a8
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
@@ -166,7 +166,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 verifymod
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 addbranchrevs(lrepo, repo, branches, revs):
if not branches:
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -25,7 +25,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)
diff --git a/tests/test-schemes b/tests/test-schemes
--- a/tests/test-schemes
+++ b/tests/test-schemes
@@ -7,6 +7,7 @@ schemes=
[schemes]
l = http://localhost:$HGPORT/
parts = http://{1}:$HGPORT/
+z = file:\$PWD/
EOF
hg init test
@@ -22,5 +23,8 @@ hg incoming l://
echo % check that {1} syntax works
hg incoming --debug parts://localhost | sed 's/[0-9]//g'
+echo % check that paths are expanded
+PWD=`pwd` hg incoming z://
+
echo % errors
cat errors.log
diff --git a/tests/test-schemes.out b/tests/test-schemes.out
--- a/tests/test-schemes.out
+++ b/tests/test-schemes.out
@@ -9,4 +9,8 @@ comparing with parts://localhost
sending heads command
searching for changes
no changes found
+% check that paths are expanded
+comparing with z://
+searching for changes
+no changes found
% errors
More information about the Mercurial-devel
mailing list