D6709: config: add --registered flag to show all known configs
av6 (Anton Shestakov)
phabricator at mercurial-scm.org
Sat Aug 24 05:24:21 UTC 2019
This revision now requires changes to proceed.
av6 added a comment.
av6 requested changes to this revision.
I'm strongly -1 on adding qualifiers straight to the keys. The primary usage scenario here is scripts (as explained in issue6014) -- regular users lived without this feature for years and didn't care (enough to file a bug) about getting all config options, or their default values, //or// the experimental status (they could and still can read it in hg help config). `--registered` is needed for things like shell completions, and the output needs to be clear and parseable (and consistent with what regular showconfig shows).
Even adding "(default: x)" to values already complicates the parsing process to get multiple config options in a script. Yeah, a script can get individual values one by one, but it can take ages because of the start-up time (again, this is important for interactive scripts like shell completions).
Let's add a test to this patch that demonstrates that scripts can //easily// use this new functionality. Something like `$ hg showconfig --registered -T '{name}={value}\n' | egrep '^(color|diff)'`. Notice how this uses -T, which is recommended, but people writing scripts in the wild may not even use, and extra things in the output (i.e. anything other than just key and value) will trip their scripts up. Maaaybe if we put a strongly worded note in hg help showconfig about scripting and usage of -T, maybe then adding "(EXPERIMENTAL)" would make sense. But I think the current format of adding it to the key is weird and it would be better to add it to the end of the line, similar to what experimental CLI flags have in the output of `hg help -v command` (if at all, because, again, that is not how regular showconfig behaves and we do have both defaults and experimental statuses in hg help config).
Sorry for coming up with this new condition only now, but I thought everyone was already on the same page.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D6709/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D6709
To: navaneeth.suresh, #hg-reviewers, av6, marmoute, durin42
Cc: durin42, mharbison72, yuja, pulkit, marmoute, av6, mjpieters, mercurial-devel
More information about the Mercurial-devel
mailing list