clone: remove "file://" before making the path absolute
This avoids writing bogus paths to .hgrc. Fixes issue695.
--- 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
--- 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
--- 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