changeset 6524:23ef198efce9

Hoist localpath to the top level
author Bryan O'Sullivan <bos@serpentine.com>
date Fri, 11 Apr 2008 22:18:38 -0700
parents 98dfc5751fdc
children a020247d75e5
files mercurial/hg.py
diffstat 1 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- 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)