[PATCH] subrepo: use correct paths for subrepos with ..-relative paths on windows

Mads Kiilerich mads at kiilerich.com
Mon Nov 14 19:38:24 CST 2011


Mads Kiilerich wrote, On 11/15/2011 02:36 AM:
> # HG changeset patch
> # User Mads Kiilerich<mads at kiilerich.com>
> # Date 1321319790 -3600
> # Branch stable
> # Node ID 745e887efdf302dbf2b1e22608f4c7b923ad4bdf
> # Parent  ad22fd3a8a8fbeaee9eb990e7bf8ddd3c3a24fb4
> subrepo: use correct paths for subrepos with ..-relative paths on windows
>
> posixpath normpath of c:\foo\bar/../baz is baz, so now we pconvert first.
>
> diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
> --- a/mercurial/subrepo.py
> +++ b/mercurial/subrepo.py
> @@ -223,7 +223,7 @@
>           source.path = posixpath.normpath(source.path)
>           parent = _abssource(repo._subparent, push, abort=False)
>           if parent:
> -            parent = util.url(parent)
> +            parent = util.url(util.pconvert(parent))
>               parent.path = posixpath.join(parent.path or '', source.path)
>               parent.path = posixpath.normpath(parent.path)
>               return str(parent)

Is this the right place to fix this?

In general we try to preserve and show native paths in a lot of places, 
but a windows users will see a lot of 'unix' paths used as file system 
paths anyway.

Wouldn't it be better and simpler to convert to 'unix' paths as early as 
possible and consistently report 'unix' paths to the user?

/Mads


More information about the Mercurial-devel mailing list