[PATCH STABLE] subrepo: handle 'C:' style paths on the command line (issue5770)

Yuya Nishihara yuya at tcha.org
Tue Jan 23 06:57:54 EST 2018


On Mon, 22 Jan 2018 20:33:21 -0500, Matt Harbison wrote:
> On Mon, 22 Jan 2018 07:38:39 -0500, Yuya Nishihara <yuya at tcha.org> wrote:
> > On Sun, 21 Jan 2018 15:50:33 -0500, Matt Harbison wrote:
> >> Rather than fixing every command call site, just convert it in the  
> >> common
> >> subrepo location.  I don't see any sanitizing on the path config  
> >> options, so I
> >> fixed those too.  Note that while the behavior is fixed here, there are  
> >> still
> >> places where 'comparing with C:' gets printed out, and that's not great  
> >> for
> >> debugging purposes.  (Specifically I saw it in `hg incoming -B C:`,  
> >> without
> >> subrepos.)  While clone will write out an absolute default path, I  
> >> wonder what
> >> would happen if a user edited that path to be 'C:'.  (I don't think  
> >> supporting
> >> relative paths in .hgrc is a sane thing to do, but while we're poking  
> >> holes in
> >> things...)
> >>
> >> Since this is such an oddball case, it still leaks through in places,  
> >> and there
> >> seems to be a lot of duplicate url parsing, maybe the url parsing  
> >> should be
> >> moved to dispatch, and provide the command with a url object?  Then we  
> >> could
> >> convert this to an absolute path once, and not have to worry about it  
> >> in the
> >> rest of the code.
> >
> > It wouldn't be easy to determine which argument is a URL at dispatcher  
> > level. Perhaps we can instead add a utility function.
> 
> I was afraid of that.  But each of the related commands.py functions have  
> an explicit source/dest parameter, so I figured there had to be some magic  
> in dispatch to line this up.

It's just an alternative form to *args.

> > FYI, there's another weird bug
> > you might be interested. :)
> >
> >   $ mkdir '$foo'
> >   $ cd '$foo'
> >   $ hg init
> >   $ foo=bar hg root
> >   abort: repository $TESTTMP/$foo not found!
> 
> Yikes.  I'm assuming the expandpath() is in there to handle `hg init  
> ~\myrepo` on Windows.  Moving it out would avoid breaking existing repos,  
> but how do we avoid the BC when given on the command line?

Here we basically do expandpath(getcwd()). That's the problem. Perhaps we
should instead apply expandpath() only to command arguments.


More information about the Mercurial-devel mailing list