mirror of
https://github.com/facebook/sapling.git
synced 2024-10-08 15:57:43 +03:00
rcutil: rename rcpath to rccomponents (API)
This commit is contained in:
parent
d3c5fd327d
commit
d63b24bd71
@ -1804,7 +1804,7 @@ def config(ui, repo, *values, **opts):
|
||||
return
|
||||
ui.pager('config')
|
||||
fm = ui.formatter('config', opts)
|
||||
for f in rcutil.rcpath():
|
||||
for f in rcutil.rccomponents():
|
||||
ui.debug('read config from: %s\n' % f)
|
||||
untrusted = bool(opts.get('untrusted'))
|
||||
if values:
|
||||
|
@ -40,23 +40,23 @@ def defaultrcpath():
|
||||
path = _expandrcpath(defaultpath)
|
||||
return path
|
||||
|
||||
_rcpath = None
|
||||
_rccomponents = None
|
||||
|
||||
def rcpath():
|
||||
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.'''
|
||||
global _rcpath
|
||||
if _rcpath is None:
|
||||
global _rccomponents
|
||||
if _rccomponents is None:
|
||||
if 'HGRCPATH' in encoding.environ:
|
||||
_rcpath = []
|
||||
_rccomponents = []
|
||||
for p in encoding.environ['HGRCPATH'].split(pycompat.ospathsep):
|
||||
if not p:
|
||||
continue
|
||||
_rcpath.extend(_expandrcpath(p))
|
||||
_rccomponents.extend(_expandrcpath(p))
|
||||
else:
|
||||
paths = defaultrcpath() + systemrcpath() + userrcpath()
|
||||
_rcpath = pycompat.maplist(os.path.normpath, paths)
|
||||
return _rcpath
|
||||
_rccomponents = pycompat.maplist(os.path.normpath, paths)
|
||||
return _rccomponents
|
||||
|
@ -212,7 +212,7 @@ class ui(object):
|
||||
"""Create a ui and load global and user configs"""
|
||||
u = cls()
|
||||
# we always trust global config files
|
||||
for f in rcutil.rcpath():
|
||||
for f in rcutil.rccomponents():
|
||||
u.readconfig(f, trust=True)
|
||||
return u
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user