[PATCH 2 of 2] subrepo: normalize path part of URLs so that webdir subrepo pulling works
Edouard Gomez
ed.gomez at free.fr
Wed Mar 10 08:25:54 CST 2010
# HG changeset patch
# User Edouard Gomez <ed.gomez at free.fr>
# Date 1268174010 -3600
# Node ID e39bab9f95d178cb877ecc4db54c64ec66bba80b
# Parent 383f2a87901a9f9c1f46dfb92421098e38dc1b26
subrepo: normalize path part of URLs so that webdir subrepo pulling works
This fixes the case where a webdir exposes a flat list of projects
and some of them use subrepos pointing relatively to .. to reach the
root.
diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -135,7 +135,13 @@
if '://' in parent:
if parent[-1] == '/':
parent = parent[:-1]
- return parent + '/' + source
+ import urlparse
+ import posixpath
+ r = urlparse.urlparse(parent + '/' + source)
+ r = urlparse.urlunparse((r.scheme, r.netloc,
+ posixpath.normpath(r.path),
+ r.params, r.query, r.fragment))
+ return r
return os.path.join(parent, repo._subsource)
if push and repo.ui.config('paths', 'default-push'):
return repo.ui.config('paths', 'default-push', repo.root)
More information about the Mercurial-devel
mailing list