# HG changeset patch # User Alexis S. L. Carvalho # Date 1188189875 10800 # Node ID 76c4cadb49fc0e9555078dbc0a204fa98a3a4ebc # Parent 20817af258d87f0262a9c4f933ee134689d40b3c clone: remove "file://" before making the path absolute This avoids writing bogus paths to .hgrc. Fixes issue695. diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -141,7 +141,7 @@ def clone(ui, source, dest=None, pull=Fa abspath = origsource copy = False if src_repo.local() and islocal(dest): - abspath = os.path.abspath(origsource) + abspath = os.path.abspath(util.drop_scheme('file', origsource)) copy = not pull and not rev src_lock, dest_lock = None, None diff --git a/tests/test-clone b/tests/test-clone --- a/tests/test-clone +++ b/tests/test-clone @@ -25,3 +25,11 @@ cd ../d hg clone ../a cd a hg cat a + +# check that we drop the file:// from the path before +# writing the .hgrc +cd ../.. +hg clone file://a e +grep 'file:' e/.hg/hgrc + +exit 0 diff --git a/tests/test-clone.out b/tests/test-clone.out --- a/tests/test-clone.out +++ b/tests/test-clone.out @@ -14,3 +14,4 @@ 1 files, 1 changesets, 1 total revisions destination directory: a 1 files updated, 0 files merged, 0 files removed, 0 files unresolved a +1 files updated, 0 files merged, 0 files removed, 0 files unresolved