comparison mercurial/commands.py @ 31683:00e569a2da97

rcutil: let rccomponents return different types of configs (API) The next patches will convert environ to raw config items, and insert the config items between systemrcpath and userrcpath. This patch teaches rccomponents to return the type information so the caller could distinguish between "path" and raw config "items".
author Jun Wu <quark@fb.com>
date Sun, 26 Mar 2017 21:04:29 -0700
parents 07d62fa518a4
children d83e51654c8a
comparison
equal deleted inserted replaced
31682:07d62fa518a4 31683:00e569a2da97
1802 onerr=error.Abort, errprefix=_("edit failed"), 1802 onerr=error.Abort, errprefix=_("edit failed"),
1803 blockedtag='config_edit') 1803 blockedtag='config_edit')
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.rccomponents(): 1807 for t, f in rcutil.rccomponents():
1808 ui.debug('read config from: %s\n' % f) 1808 if t == 'path':
1809 ui.debug('read config from: %s\n' % f)
1810 else:
1811 raise error.ProgrammingError('unknown rctype: %s' % t)
1809 untrusted = bool(opts.get('untrusted')) 1812 untrusted = bool(opts.get('untrusted'))
1810 if values: 1813 if values:
1811 sections = [v for v in values if '.' not in v] 1814 sections = [v for v in values if '.' not in v]
1812 items = [v for v in values if '.' in v] 1815 items = [v for v in values if '.' in v]
1813 if len(items) > 1 or items and sections: 1816 if len(items) > 1 or items and sections: