# HG changeset patch # User Pierre-Yves David # Date 2024-10-21 12:13:37 # Node ID e98cea8fc85879e745447a59ed0b4d690f17de8c # Parent c97e0fd262257f7febe1340aa96f1bfa4ebc5da5 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. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -68,7 +68,6 @@ from . import ( from .cmd_impls import graft as graft_impl from .configuration import ( command as config_command, - rcutil, ) from .utils import ( dateutil, @@ -2370,18 +2369,10 @@ def config(ui, repo, *values, **opts): edit_level = config_command.find_edit_level(ui, repo, opts) if edit_level is not None: return config_command.edit_config(ui, repo, edit_level) + ui.pager(b'config') + config_command.show_component(ui, repo) fm = ui.formatter(b'config', pycompat.byteskwargs(opts)) - 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) untrusted = bool(opts.get('untrusted')) selsections = selentries = [] diff --git a/mercurial/configuration/command.py b/mercurial/configuration/command.py --- a/mercurial/configuration/command.py +++ b/mercurial/configuration/command.py @@ -106,3 +106,21 @@ def edit_config(ui: uimod.ui, repo, leve 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)