mercurial/rcutil.py
changeset 31692 cf052cc5c2c2
parent 31685 d83e51654c8a
child 31693 67f0377bd24b
equal deleted inserted replaced
31691:c3ca0ad8ab9c 31692:cf052cc5c2c2
    60     defaultpath = os.path.join(util.datapath, 'default.d')
    60     defaultpath = os.path.join(util.datapath, 'default.d')
    61     if os.path.isdir(defaultpath):
    61     if os.path.isdir(defaultpath):
    62         path = _expandrcpath(defaultpath)
    62         path = _expandrcpath(defaultpath)
    63     return path
    63     return path
    64 
    64 
    65 _rccomponents = None
       
    66 
       
    67 def rccomponents():
    65 def rccomponents():
    68     '''return an ordered [(type, obj)] about where to load configs.
    66     '''return an ordered [(type, obj)] about where to load configs.
    69 
    67 
    70     respect $HGRCPATH. if $HGRCPATH is empty, only .hg/hgrc of current repo is
    68     respect $HGRCPATH. if $HGRCPATH is empty, only .hg/hgrc of current repo is
    71     used. if $HGRCPATH is not set, the platform default will be used.
    69     used. if $HGRCPATH is not set, the platform default will be used.
    76     and is the config file path. if type is 'items', obj is a list of (section,
    74     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.
    75     name, value, source) that should fill the config directly.
    78     '''
    76     '''
    79     envrc = ('items', envrcitems())
    77     envrc = ('items', envrcitems())
    80 
    78 
    81     global _rccomponents
    79     _rccomponents = None
    82     if _rccomponents is None:
    80     if _rccomponents is None:
    83         if 'HGRCPATH' in encoding.environ:
    81         if 'HGRCPATH' in encoding.environ:
    84             # assume HGRCPATH is all about user configs so environments can be
    82             # assume HGRCPATH is all about user configs so environments can be
    85             # overridden.
    83             # overridden.
    86             _rccomponents = [envrc]
    84             _rccomponents = [envrc]