Mercurial > hg-stable
diff mercurial/rcutil.py @ 31690:d83e51654c8a
rcutil: let environ override system configs (BC)
This is BC because system configs won't be able to override $EDITOR, $PAGER.
The new behavior is arguably more rational.
author | Jun Wu <quark@fb.com> |
---|---|
date | Sun, 26 Mar 2017 21:33:37 -0700 |
parents | 0be96ac9199a |
children | cf052cc5c2c2 |
line wrap: on
line diff
--- a/mercurial/rcutil.py Sun Mar 26 21:27:02 2017 -0700 +++ b/mercurial/rcutil.py Sun Mar 26 21:33:37 2017 -0700 @@ -76,15 +76,22 @@ and is the config file path. if type is 'items', obj is a list of (section, 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: continue _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) return _rccomponents