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

Matt Mackall mpm at selenic.com
Wed Nov 16 17:51:50 CST 2011


On Tue, 2011-11-15 at 02:38 +0100, Mads Kiilerich wrote:
> 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?

It'll do. Queued, thanks.

> 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?

This is tricky. Paths with '/' are canonical in terms of what's stored
in history, but users want to talk about paths with '\' when looking at
the filesystem on Windows. I have a hard time coming up with a hard and
fast rule for this. For instance, 'hg log -p' should show '/', 'hg
status' should show '\', but what about 'hg diff' and 'hg status -C'?

On the upside, Windows internally has always accepted '/' for '\' since
directory support was added in DOS 2.0, so as long as we're internally
always using '/', we only have cosmetic issues.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list