[PATCH stable] subrepo: use code from 71ea5b2b9517 only if Python needs it (issue2795)

Thomas Arendsen Hein thomas at intevation.de
Thu May 5 09:53:35 CDT 2011


# HG changeset patch
# User Thomas Arendsen Hein <thomas at intevation.de>
# Date 1304604069 -7200
# Branch stable
# Node ID 7b627923739f1f22b9ef30e203d366d5de656a91
# Parent  31ec4d7eb63f568654a3f0c9d19c18a23145a12e
subrepo: use code from 71ea5b2b9517 only if Python needs it (issue2795)

With Python >= 2.6 the original code already works correct, therefore the
fix for issue2556 on Python <= 2.5 broke relative subrepositories with
newer versions of Python.

diff -r 31ec4d7eb63f -r 7b627923739f mercurial/subrepo.py
--- a/mercurial/subrepo.py	Tue May 03 11:46:02 2011 -0500
+++ b/mercurial/subrepo.py	Thu May 05 16:01:09 2011 +0200
@@ -203,7 +203,8 @@
                 if parent[-1] == '/':
                     parent = parent[:-1]
                 r = urlparse.urlparse(parent + '/' + source)
-                if parent.startswith('ssh://'):
+                if parent.startswith('ssh://') and not r[1]:
+                    # Python before 2.6 parses ssh:// URLs wrong
                     host, path = r[2][2:].split('/', 1)
                     r2 = '//%s/%s' % (host, posixpath.normpath(path))
                 else:


More information about the Mercurial-devel mailing list