# HG changeset patch # User Brodie Rao # Date 1301119144 25200 # Node ID ce6227306c9ae056078abc8e2aaacdb62630aaea # Parent 4e8f2310f310663527e0e9a58e885668ba153379 subrepos: use url.url when normalizing repo paths This works around an issue in older versions of Python that would strip double slashes from SSH URLs when using urlunparse() on a parsed URL. Related issues: - issue1755: WinXP: cmd line hg 1.3 clone of subrepo fails, due to %5C '\'? (originally fixed by f783bb979fb3). diff -r 4e8f2310f310 -r ce6227306c9a mercurial/subrepo.py --- a/mercurial/subrepo.py Fri Mar 25 22:58:56 2011 -0700 +++ b/mercurial/subrepo.py Fri Mar 25 22:59:04 2011 -0700 @@ -5,10 +5,10 @@ # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. -import errno, os, re, xml.dom.minidom, shutil, urlparse, posixpath +import errno, os, re, xml.dom.minidom, shutil, posixpath import stat, subprocess, tarfile from i18n import _ -import config, util, node, error, cmdutil, bookmarks +import config, util, node, error, cmdutil, url, bookmarks hg = None nullstate = ('', '', 'empty') @@ -193,21 +193,16 @@ """return pull/push path of repo - either based on parent repo .hgsub info or on the top repo config. Abort or return None if no source found.""" if hasattr(repo, '_subparent'): - source = repo._subsource - if source.startswith('/') or '://' in source: - return source + source = url.url(repo._subsource) + source.path = posixpath.normpath(source.path) + if posixpath.isabs(source.path) or source.scheme: + return str(source) parent = _abssource(repo._subparent, push, abort=False) if parent: - if '://' in parent: - if parent[-1] == '/': - parent = parent[:-1] - r = urlparse.urlparse(parent + '/' + source) - r = urlparse.urlunparse((r[0], r[1], - posixpath.normpath(r[2]), - r[3], r[4], r[5])) - return r - else: # plain file system path - return posixpath.normpath(os.path.join(parent, repo._subsource)) + parent = url.url(parent) + parent.path = posixpath.join(parent.path, source.path) + parent.path = posixpath.normpath(parent.path) + return str(parent) else: # recursion reached top repo if hasattr(repo, '_subtoppath'): return repo._subtoppath