[PATCH 2 of 4] subrepo: normalize path part of URLs so that pulling subrepos from webdir works

Benoit Boissinot benoit.boissinot at ens-lyon.org
Sat Mar 13 09:00:25 CST 2010


On Fri, Mar 12, 2010 at 01:47:55AM +0100, Edouard Gomez wrote:
> # HG changeset patch
> # User Edouard Gomez <ed.gomez at free.fr>
> # Date 1268353415 -3600
> # Node ID 5d36ceb7202a45c9112de5dbf4e3a4f0fac921f4
> # Parent  59de7c5a645b0e81777517d1c2f44bdb5f96eaf6
> subrepo: normalize path part of URLs so that pulling subrepos from webdir works
> 
> diff -r 59de7c5a645b -r 5d36ceb7202a mercurial/subrepo.py
> --- a/mercurial/subrepo.py	Fri Mar 12 01:23:35 2010 +0100
> +++ b/mercurial/subrepo.py	Fri Mar 12 01:23:35 2010 +0100
> @@ -5,7 +5,7 @@
>  # 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
> +import errno, os, re, xml.dom.minidom, shutil, urlparse, posixpath
>  from i18n import _
>  import config, util, node, error
>  hg = None
> @@ -135,8 +135,12 @@
>          if '://' in parent:
>              if parent[-1] == '/':
>                  parent = parent[:-1]
> -            return parent + '/' + source
> -        return os.path.join(parent, repo._subsource)
> +            r = urlparse.urlparse(parent + '/' + source)
> +            r = urlparse.urlunparse((r.scheme, r.netloc,
> +                                     posixpath.normpath(r.path),
> +                                     r.params, r.query, r.fragment))
> +            return r

I don't think the named tuples works in python2.4.

In general could you add more information to the changelog? Like give an
example so it's easier to review (or add a test to the change).

Thanks!

Benoit

-- 
:wq


More information about the Mercurial-devel mailing list