Mercurial > public > mercurial-scm > hg
diff mercurial/configuration/command.py @ 52418:e98cea8fc858
config: move "component display" in the new module
That part seems dubious, but at least it is now isolated. I added inline comment
about how "suboptimal" it is.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 21 Oct 2024 14:13:37 +0200 |
parents | c97e0fd26225 |
children | 04c3fb885fb6 |
line wrap: on
line diff
--- a/mercurial/configuration/command.py Mon Oct 21 14:05:14 2024 +0200 +++ b/mercurial/configuration/command.py Mon Oct 21 14:13:37 2024 +0200 @@ -106,3 +106,21 @@ errprefix=_(b"edit failed"), blockedtag=b'config_edit', ) + + +def show_component(ui: uimod.ui, repo) -> None: + """show the component used to build the config + + XXX this skip over various source and ignore the repository config, so it + XXX is probably useless old code. + """ + for t, f in rcutil.rccomponents(): + if t == b'path': + ui.debug(b'read config from: %s\n' % f) + elif t == b'resource': + ui.debug(b'read config from: resource:%s.%s\n' % (f[0], f[1])) + elif t == b'items': + # Don't print anything for 'items'. + pass + else: + raise error.ProgrammingError(b'unknown rctype: %s' % t)