[PATCH] subrepo: prevent url normalization from removing // in ssh paths (issue2556)

Thomas Arendsen Hein thomas at intevation.de
Thu Apr 7 11:42:39 CDT 2011


# HG changeset patch
# User Thomas Arendsen Hein <thomas at intevation.de>
# Date 1302172427 -7200
# Branch stable
# Node ID 71ea5b2b95173570d39a75a0229725dfac2f0ab7
# Parent  08d49b6b8d320eb7cf6705a6eefe68c25a39bdba
subrepo: prevent url normalization from removing // in ssh paths (issue2556)

diff -r 08d49b6b8d32 -r 71ea5b2b9517 mercurial/subrepo.py
--- a/mercurial/subrepo.py	Thu Apr 07 13:23:07 2011 +0530
+++ b/mercurial/subrepo.py	Thu Apr 07 12:33:47 2011 +0200
@@ -202,8 +202,12 @@
                 if parent[-1] == '/':
                     parent = parent[:-1]
                 r = urlparse.urlparse(parent + '/' + source)
-                r = urlparse.urlunparse((r[0], r[1],
-                                         posixpath.normpath(r[2]),
+                if parent.startswith('ssh://'):
+                    host, path = r[2][2:].split('/', 1)
+                    r2 = '//%s/%s' % (host, posixpath.normpath(path))
+                else:
+                    r2 = posixpath.normpath(r[2])
+                r = urlparse.urlunparse((r[0], r[1], r2,
                                          r[3], r[4], r[5]))
                 return r
             else: # plain file system path


More information about the Mercurial-devel mailing list