Hoist localpath to the top level
authorBryan O'Sullivan <bos@serpentine.com>
Fri, 11 Apr 2008 22:18:38 -0700
changeset 6524 23ef198efce9
parent 6523 98dfc5751fdc
child 6525 a020247d75e5
Hoist localpath to the top level
mercurial/hg.py
--- a/mercurial/hg.py	Fri Apr 11 22:17:20 2008 -0700
+++ b/mercurial/hg.py	Fri Apr 11 22:18:38 2008 -0700
@@ -69,6 +69,15 @@
     '''return default destination of clone if none is given'''
     return os.path.basename(os.path.normpath(source))
 
+def localpath(path):
+    if path.startswith('file://localhost/'):
+        return path[16:]
+    if path.startswith('file://'):
+        return path[7:]
+    if path.startswith('file:'):
+        return path[5:]
+    return path
+
 def clone(ui, source, dest=None, pull=False, rev=None, update=True,
           stream=False):
     """Make a copy of an existing repository.
@@ -116,15 +125,6 @@
         dest = defaultdest(source)
         ui.status(_("destination directory: %s\n") % dest)
 
-    def localpath(path):
-        if path.startswith('file://localhost/'):
-            return path[16:]
-        if path.startswith('file://'):
-            return path[7:]
-        if path.startswith('file:'):
-            return path[5:]
-        return path
-
     dest = localpath(dest)
     source = localpath(source)