[PATCH 1 of 3] ui: expand paths more consistently in configpath()

Matt Mackall mpm at selenic.com
Fri Dec 2 15:39:43 CST 2011


On Thu, 2011-12-01 at 11:22 +0100, Mads Kiilerich wrote:
> On 12/01/2011 03:41 AM, Greg Ward wrote:
> > # HG changeset patch
> > # User Greg Ward<greg at gerg.ca>
> > # Date 1319422202 14400
> > # Node ID 9f8b6ff50a93a0b5d19bf1fd54c6f50794482d21
> > # Parent  ad686c818e1c7d5ed0335327321003ba8ea04664
> > ui: expand paths more consistently in configpath()
> >
> > - use util.expandpath() so we expand environment variables
> >    in addition to "~/"
> > - call it earlier so it's guaranteed to happen (if the user
> >    actually supplied a value, that is)
> >
> > diff --git a/mercurial/ui.py b/mercurial/ui.py
> > --- a/mercurial/ui.py
> > +++ b/mercurial/ui.py
> > @@ -181,11 +181,12 @@
> >           v = self.config(section, name, default, untrusted)
> >           if v is None:
> >               return None
> > +        v = util.expandpath(v)
> >           if not os.path.isabs(v) or "://" not in v:
> >               src = self.configsource(section, name, untrusted)
> >               if ':' in src:
> >                   base = os.path.dirname(src.rsplit(':')[0])
> > -                v = os.path.join(base, os.path.expanduser(v))
> > +                v = os.path.join(base, v)
> >           return v
> 
> The patch in http://markmail.org/message/fcgvz5zij62triwk is quite 
> similar. (It also adds some tests so we get _some_ test coverage of this 
> code. Hint hint ;-) )

Again, what's needed here to make progress is an audit. I'm
uncomfortable evaluating all these small changes one-by-one. I'd rather
back out to the big picture.

Please grep for all the config path users and group/sort/comment on
their current semantics. I'm quite sure some of the current semantics in
some places are buggy (ie relative to the current directory for no good
reason) and can be fixed, but other things might be trickier. Then we'll
set about seeing what groups of semantics can be safely unified.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list