mercurial/rcutil.py
changeset 31685 d83e51654c8a
parent 31684 0be96ac9199a
child 31692 cf052cc5c2c2
equal deleted inserted replaced
31684:0be96ac9199a 31685:d83e51654c8a
    74 
    74 
    75     type could be either 'path' or 'items', if type is 'path', obj is a string,
    75     type could be either 'path' or 'items', if type is 'path', obj is a string,
    76     and is the config file path. if type is 'items', obj is a list of (section,
    76     and is the config file path. if type is 'items', obj is a list of (section,
    77     name, value, source) that should fill the config directly.
    77     name, value, source) that should fill the config directly.
    78     '''
    78     '''
       
    79     envrc = ('items', envrcitems())
       
    80 
    79     global _rccomponents
    81     global _rccomponents
    80     if _rccomponents is None:
    82     if _rccomponents is None:
    81         if 'HGRCPATH' in encoding.environ:
    83         if 'HGRCPATH' in encoding.environ:
    82             _rccomponents = []
    84             # assume HGRCPATH is all about user configs so environments can be
       
    85             # overridden.
       
    86             _rccomponents = [envrc]
    83             for p in encoding.environ['HGRCPATH'].split(pycompat.ospathsep):
    87             for p in encoding.environ['HGRCPATH'].split(pycompat.ospathsep):
    84                 if not p:
    88                 if not p:
    85                     continue
    89                     continue
    86                 _rccomponents.extend(('path', p) for p in _expandrcpath(p))
    90                 _rccomponents.extend(('path', p) for p in _expandrcpath(p))
    87         else:
    91         else:
    88             paths = defaultrcpath() + systemrcpath() + userrcpath()
    92             paths = defaultrcpath() + systemrcpath()
    89             _rccomponents = [('path', os.path.normpath(p)) for p in paths]
    93             _rccomponents = [('path', os.path.normpath(p)) for p in paths]
       
    94             _rccomponents.append(envrc)
       
    95             paths = userrcpath()
       
    96             _rccomponents.extend(('path', os.path.normpath(p)) for p in paths)
    90     return _rccomponents
    97     return _rccomponents