[PATCH] init: expand configured paths
Mads Kiilerich
mads at kiilerich.com
Sun Aug 8 18:01:26 CDT 2010
# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1281308426 -7200
# Node ID 374d15fead75dd0892d2cd665c7f6ab8b993ad91
# Parent fc8dc1afd52f339dc8471ecbec29a50fb21566f2
init: expand configured paths
Most commands expands configured paths when repositories are specified. Clone
also expands the destination path (even though it doesn't contain a repository
yet). This makes init do the same.
The existing behavior caused the confusion in
http://selenic.com/pipermail/mercurial/2010-August/034108.html
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2397,7 +2397,7 @@
Returns 0 on success.
"""
- hg.repository(hg.remoteui(ui, opts), dest, create=1)
+ hg.repository(hg.remoteui(ui, opts), ui.expandpath(dest), create=1)
def locate(ui, repo, *pats, **opts):
"""locate files matching specific patterns
diff --git a/tests/test-init b/tests/test-init
--- a/tests/test-init
+++ b/tests/test-init
@@ -27,15 +27,15 @@
{
name=$1
- if [ -d $name/.hg/store ]; then
+ if [ -d "$name"/.hg/store ]; then
echo store created
fi
- if [ -f $name/.hg/00changelog.i ]; then
+ if [ -f "$name"/.hg/00changelog.i ]; then
echo 00changelog.i created
fi
- cat $name/.hg/requires
+ cat "$name"/.hg/requires
}
echo "# creating 'local'"
@@ -87,3 +87,9 @@
echo "# creating 'local/sub/repo'"
hg init local/sub/repo
checknewrepo local/sub/repo
+
+echo "# using paths"
+echo '[paths]' >> $HGRCPATH
+echo "somewhere = `pwd`/url from paths" >> $HGRCPATH
+hg init somewhere
+checknewrepo "url from paths"
diff --git a/tests/test-init.out b/tests/test-init.out
--- a/tests/test-init.out
+++ b/tests/test-init.out
@@ -79,3 +79,9 @@
revlogv1
store
fncache
+# using paths
+store created
+00changelog.i created
+revlogv1
+store
+fncache
More information about the Mercurial-devel
mailing list