Bug 5797 - hg config: only 1 config option allowed
Summary: hg config: only 1 config option allowed
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: 4.4.2
Hardware: PC Windows
: wish feature
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-02-19 04:49 UTC by Mathias De Maré
Modified: 2018-03-07 00:00 UTC (History)
3 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mathias De Maré 2018-02-19 04:49 UTC
The help for hg config indicates that multiple config options can be specified: hg config [-u] [NAME]...

Trying this out unfortunately fails:

$ hg config a.a b.b
abort: only one config item permitted
Comment 1 Yuya Nishihara 2018-02-19 09:22 UTC
It's documented as follows:
>     With one argument of the form section.name, print just the value
>     of that config item.
> 
>     With multiple arguments, print names and values of all config
>     items with matching section names.

So the valid syntax is:
  $ hg config SECTION.NAME
or
  $ hg config SECTION SECTION...

Maybe we can allow multiple SECTION.NAMEs, but the default output format
isn't well suited for that.
Comment 2 Augie Fackler 2018-02-20 17:19 UTC
I feel like `hg config remotefilelog.cachelimit ui.username` could have the same output as this:

augie% hg config remotefilelog ui | egrep '(cachelimit|username)'
remotefilelog.cachelimit=2 GB
ui.username=Augie Fackler <raf@durin42.com>


Basically, show only the value if we have a single config item, and show section.key=value if we had more than one. What do you think?
Comment 3 Yuya Nishihara 2018-02-21 06:36 UTC
> show only the value if we have a single config item, and show section.key=value if we had more than one.

Seems fine. More precisely, show only the value if a single fully-qualified
config name is specified.
Comment 4 Mathias De Maré 2018-02-22 05:23 UTC
That's indeed the behaviour I expected.
Comment 5 HG Bot 2018-02-27 19:10 UTC
Fixed by https://mercurial-scm.org/repo/hg/rev/199443c55463
Yuya Nishihara <yuya@tcha.org>
showconfig: allow multiple section.name selectors (issue5797)

This seems useful and we can disambiguate the output format solely by the
type of the command arguments.

(please test the fix)
Comment 6 Bugzilla 2018-03-07 00:00 UTC
Bug was set to TESTING for 7 days, resolving