mercurial/hg.py
changeset 4478 b2b55acbacdd
parent 4477 6cbfa740c129
child 4635 63b9d2deed48
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -10,7 +10,7 @@ from node import *
 from repo import *
 from i18n import _
 import localrepo, bundlerepo, httprepo, sshrepo, statichttprepo
-import errno, lock, os, shutil, util
+import errno, lock, os, shutil, util, cmdutil
 import merge as _merge
 import verify as _verify
 
@@ -97,6 +97,10 @@ def clone(ui, source, dest=None, pull=Fa
     update: update working directory after clone completes, if
     destination is local repository
     """
+
+    origsource = source
+    source, rev = cmdutil.parseurl(ui.expandpath(source), rev)
+
     if isinstance(source, str):
         src_repo = repository(ui, source)
     else:
@@ -134,10 +138,10 @@ def clone(ui, source, dest=None, pull=Fa
     if islocal(dest):
         dir_cleanup = DirCleanup(dest)
 
-    abspath = source
+    abspath = origsource
     copy = False
     if src_repo.local() and islocal(dest):
-        abspath = os.path.abspath(source)
+        abspath = os.path.abspath(origsource)
         copy = not pull and not rev
 
     src_lock, dest_lock = None, None