##// END OF EJS Templates
rcutil: rename rcpath to rccomponents (API)
Jun Wu -
r31682:07d62fa5 default
parent child Browse files
Show More
@@ -1804,7 +1804,7 b' def config(ui, repo, *values, **opts):'
1804 return
1804 return
1805 ui.pager('config')
1805 ui.pager('config')
1806 fm = ui.formatter('config', opts)
1806 fm = ui.formatter('config', opts)
1807 for f in rcutil.rcpath():
1807 for f in rcutil.rccomponents():
1808 ui.debug('read config from: %s\n' % f)
1808 ui.debug('read config from: %s\n' % f)
1809 untrusted = bool(opts.get('untrusted'))
1809 untrusted = bool(opts.get('untrusted'))
1810 if values:
1810 if values:
@@ -40,23 +40,23 b' def defaultrcpath():'
40 path = _expandrcpath(defaultpath)
40 path = _expandrcpath(defaultpath)
41 return path
41 return path
42
42
43 _rcpath = None
43 _rccomponents = None
44
44
45 def rcpath():
45 def rccomponents():
46 '''return hgrc search path. if env var HGRCPATH is set, use it.
46 '''return hgrc search path. if env var HGRCPATH is set, use it.
47 for each item in path, if directory, use files ending in .rc,
47 for each item in path, if directory, use files ending in .rc,
48 else use item.
48 else use item.
49 make HGRCPATH empty to only look in .hg/hgrc of current repo.
49 make HGRCPATH empty to only look in .hg/hgrc of current repo.
50 if no HGRCPATH, use default os-specific path.'''
50 if no HGRCPATH, use default os-specific path.'''
51 global _rcpath
51 global _rccomponents
52 if _rcpath is None:
52 if _rccomponents is None:
53 if 'HGRCPATH' in encoding.environ:
53 if 'HGRCPATH' in encoding.environ:
54 _rcpath = []
54 _rccomponents = []
55 for p in encoding.environ['HGRCPATH'].split(pycompat.ospathsep):
55 for p in encoding.environ['HGRCPATH'].split(pycompat.ospathsep):
56 if not p:
56 if not p:
57 continue
57 continue
58 _rcpath.extend(_expandrcpath(p))
58 _rccomponents.extend(_expandrcpath(p))
59 else:
59 else:
60 paths = defaultrcpath() + systemrcpath() + userrcpath()
60 paths = defaultrcpath() + systemrcpath() + userrcpath()
61 _rcpath = pycompat.maplist(os.path.normpath, paths)
61 _rccomponents = pycompat.maplist(os.path.normpath, paths)
62 return _rcpath
62 return _rccomponents
@@ -212,7 +212,7 b' class ui(object):'
212 """Create a ui and load global and user configs"""
212 """Create a ui and load global and user configs"""
213 u = cls()
213 u = cls()
214 # we always trust global config files
214 # we always trust global config files
215 for f in rcutil.rcpath():
215 for f in rcutil.rccomponents():
216 u.readconfig(f, trust=True)
216 u.readconfig(f, trust=True)
217 return u
217 return u
218
218
General Comments 0
You need to be logged in to leave comments. Login now