Config Alias Cleanups
Note:
This page is primarily intended for developers of Mercurial.
1. Overview
Mercurial has an internal config-aliasing feature that lets us rename config values. This has facilitated cleaning up some of the disorganized config sections and making things more discoverable or readable (since we can rename config names to contain dashes).
2. Known Issues
If we have a hypothetical knob ui.frobnicate and we want to move it to commands.frobnicate-yes, we add an alias. But now it's unclear which knob wins if the user has an hgrc file that contains both. We need to:
- Define the order in which they apply
- Have an affordance for users to identify and clean up their legacy-named configs
- Warn users when they have colliding config names
- Have a way to avoid bogus warnings when enterprise-managed configs (eg /etc/hgrc.d/* files) disagree with ~/.hgrc about config names.
3. Proposed solutions
Add an hg debug-lint-config command (name should probably be improved) to enumerate legacy-name config entries
- Runtime warning (when not in HGPLAIN mode) that can be disabled by a config knob to warn users when they have the same item under multiple names
- Coalesce config entries when loading configs, so that it's only an issue if the same config knob occurs in the same "level" of config (eg system, user, repo).