[Bug 6014] New: hg showconfig --give-me-default-value and --give-me-current-value-even-if-it-is-the-default

mercurial-bugs at mercurial-scm.org mercurial-bugs at mercurial-scm.org
Mon Oct 29 16:05:55 UTC 2018


https://bz.mercurial-scm.org/show_bug.cgi?id=6014

            Bug ID: 6014
           Summary: hg showconfig --give-me-default-value and
                    --give-me-current-value-even-if-it-is-the-default
           Product: Mercurial
           Version: unspecified
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: feature
          Priority: wish
         Component: Mercurial
          Assignee: bugzilla at mercurial-scm.org
          Reporter: av6 at dwimlabs.net
                CC: mercurial-devel at mercurial-scm.org

Looking at such tools as postconf (postfix) and doveconf (dovecot) and
comparing how they work with hg showconfig, one flaw in the latter is obvious:
it cannot be reliably used to just get the current setting. For example, when
user doesn't set ui.color anywhere in config files, the default value for it is
'auto' (configitems.py). But `hg showconfig ui.color` outputs nothing, IOW an
empty string, and not 'auto'.

If a script (e.g. shell prompt or completion file) decides to peek at certain
config values (they don't have to be related to color, of course), it will need
to know to substitute empty results from `hg showconfig` for a default value...
and there's also no way to get that default value lest it parses
mercurial/configitems.py.

What do the config tools from postfix and dovecot do then? Here are some flags
from their man pages:

> postconf: -d  print default parameter settings instead of actual settings
>           -n  Show only configuration parameters that have explicit name=value settings

> doveconf: -n  Show only settings with non-default values. [*]

Maybe showconfig could grow similar flags (names bikesheddable): -d/--default
to print default value and -a/--any for any value, including default. Or maybe
it's worth a BC to make `hg showconfig foo` print value of foo even if it's not
configured anywhere explicitly.

[*] doveconf is actually used to parse config files and feed the results to the
rest of the dovecot system, so printing all possible key=value by default pairs
makes perfect sense. Not the case of hg showconfig, but still.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Mercurial-devel mailing list