[PATCH issue2086] clone: fix path problem when cloning via schemes extension

Glenn Hutchings zondo42 at googlemail.com
Thu Mar 18 15:26:20 CDT 2010


# HG changeset patch
# User Glenn Hutchings <zondo42 at googlemail.com>
# Date 1268843337 0
# Node ID 84be941d599051479931974200e7386da7a9a92d
# Parent  1ee60e82333cba7cfff191f706b1b3ae24db3ceb
clone: fix path problem when cloning via schemes extension

Problem with running util.drop_scheme() followed by os.path.absolute() on
local repo: it assumes that after drop_scheme() the result is a bare
pathname, which is not true for local repos using the schemes extension.

diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -245,7 +245,12 @@ def clone(ui, source, dest=None, pull=Fa
         abspath = origsource
         copy = False
         if src_repo.cancopy() and islocal(dest):
-            abspath = os.path.abspath(util.drop_scheme('file', origsource))
+            # absolutize local repo pathname, being careful not to
+            # change non-file schemes (e.g., those defined using the
+            # schemes extension)
+            path = util.drop_scheme('file', origsource)
+            if '://' not in path:
+                abspath = os.path.abspath(path)
             copy = not pull and not rev

         if copy:


More information about the Mercurial-devel mailing list