--- a/mercurial/rcutil.py Sun Mar 26 20:48:00 2017 -0700
+++ b/mercurial/rcutil.py Sun Mar 26 21:04:29 2017 -0700
@@ -43,11 +43,17 @@
_rccomponents = None
def rccomponents():
- '''return hgrc search path. if env var HGRCPATH is set, use it.
- for each item in path, if directory, use files ending in .rc,
- else use item.
- make HGRCPATH empty to only look in .hg/hgrc of current repo.
- if no HGRCPATH, use default os-specific path.'''
+ '''return an ordered [(type, obj)] about where to load configs.
+
+ respect $HGRCPATH. if $HGRCPATH is empty, only .hg/hgrc of current repo is
+ used. if $HGRCPATH is not set, the platform default will be used.
+
+ if a directory is provided, *.rc files under it will be used.
+
+ type could be either 'path' or 'items', if type is 'path', obj is a string,
+ 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.
+ '''
global _rccomponents
if _rccomponents is None:
if 'HGRCPATH' in encoding.environ:
@@ -55,8 +61,8 @@
for p in encoding.environ['HGRCPATH'].split(pycompat.ospathsep):
if not p:
continue
- _rccomponents.extend(_expandrcpath(p))
+ _rccomponents.extend(('path', p) for p in _expandrcpath(p))
else:
paths = defaultrcpath() + systemrcpath() + userrcpath()
- _rccomponents = pycompat.maplist(os.path.normpath, paths)
+ _rccomponents = [('path', os.path.normpath(p)) for p in paths]
return _rccomponents