[PATCH 07 of 10 V5] rcutil: let environ override system configs (BC)

Yuya Nishihara yuya at tcha.org
Tue Mar 28 08:53:31 EDT 2017


On Tue, 28 Mar 2017 09:47:18 +0100, Ryan McElroy wrote:
> On 3/27/17 7:02 AM, Jun Wu wrote:
> > # HG changeset patch
> > # User Jun Wu <quark at fb.com>
> > # Date 1490589217 25200
> > #      Sun Mar 26 21:33:37 2017 -0700
> > # Node ID 38572bb2cffd815526a727bc6f3aacdca2902f4f
> > # Parent  9b0aa30bf151b6c0e999b017fd328e29440bd447
> > rcutil: let environ override system configs (BC)

> > --- a/mercurial/rcutil.py
> > +++ b/mercurial/rcutil.py
> > @@ -77,8 +77,12 @@ def rccomponents():
> >       name, value, source) that should fill the config directly.
> >       '''
> > +    envrc = ('items', envrcitems())
> > +
> >       global _rccomponents
> >       if _rccomponents is None:
> >           if 'HGRCPATH' in encoding.environ:
> > -            _rccomponents = []
> > +            # assume HGRCPATH is all about user configs so environments can be
> > +            # overridden.
> > +            _rccomponents = [envrc]
> >               for p in encoding.environ['HGRCPATH'].split(pycompat.ospathsep):
> >                   if not p:
> > @@ -86,5 +90,8 @@ def rccomponents():
> >                   _rccomponents.extend(('path', p) for p in _expandrcpath(p))
> >           else:
> > -            paths = defaultrcpath() + systemrcpath() + userrcpath()
> > +            paths = defaultrcpath() + systemrcpath()
> >               _rccomponents = [('path', os.path.normpath(p)) for p in paths]
> > +            _rccomponents.append(envrc)
> > +            paths = userrcpath()
> > +            _rccomponents.extend(('path', os.path.normpath(p)) for p in paths)
> 
> This line is essentially repeated from above... I think it could be 
> factored out in a future clean-up.

And we'll need to avoid caching of envrcitems because of chg, could be fixed
by followup.


More information about the Mercurial-devel mailing list