Raphaël Gomès <rgomes@octobus.net> [Thu, 06 Jul 2023 12:17:20 +0200] rev 50768
rhg: use default configitem in `cat`
Now that we've declared the items, we can get rid of the manual fallback.
Raphaël Gomès <rgomes@octobus.net> [Thu, 06 Jul 2023 11:47:41 +0200] rev 50767
rhg: add config defaults to configitems.toml
This will allow us to use the same default config mechanic as the rest of the
code.
Raphaël Gomès <rgomes@octobus.net> [Thu, 06 Jul 2023 11:17:55 +0200] rev 50766
rust-blackbox: use `is_extension_enabled` config helper
It's there, may as well use it to make the code clearer and less bug-prone.
Raphaël Gomès <rgomes@octobus.net> [Wed, 05 Jul 2023 23:59:22 +0200] rev 50765
configitems: move blackbox's config items to the new configitems.toml
In order for the Rust code to gain access to default values of in-core
extensions that have a Rust implementation, we need to centralize them
alongside the core items declarations.
This is the first and so far only one of the extensions that have gained
Rust support, I don't think it's worth the churn to move the rest of the
extension's configitems yet.
Raphaël Gomès <rgomes@octobus.net> [Mon, 13 Feb 2023 18:11:48 +0100] rev 50764
rust-config: add config getters that don't fall back to defaults
This is useful in cases where we access config items that are more... lenient
with their types than a fresh new system would allow.
For now there is only a single use of this, but we might get more later.
Raphaël Gomès <rgomes@octobus.net> [Thu, 06 Jul 2023 14:32:07 +0200] rev 50763
rust-config: add support for default config items
Now that configitems.toml exists, we can read from it the default values for
all core config items.
We will add the devel-warning for use of undeclared config items in a later
patch when we're done adding the missing entries for `rhg`.
Raphaël Gomès <rgomes@octobus.net> [Mon, 23 Jan 2023 18:08:11 +0100] rev 50762
configitems: declare items in a TOML file
Mercurial ships with Rust code that also needs to read from the config.
Having a way of presenting `configitems` to both Python and Rust is needed
to prevent duplication, drift, and have the appropriate devel warnings.
Abstracting away from Python means choosing a config format. No single format
is perfect, and I have yet to come across a developer that doesn't hate all of
them in some way.
Since we have a strict no-dependencies policy for Mercurial, we either need
to use whatever comes with Python, vendor a library, or implement a custom
format ourselves.
Python stdlib means using JSON, which doesn't support comments and isn't great
for humans, or `configparser` which is an obscure, untyped format that nobody
uses and doesn't have a commonplace Rust parser.
Implementing a custom format is error-prone, tedious and subject to the
same issues as picking an existing format.
Vendoring opens us to the vast array of common config formats. The ones
being picked for most modern software are YAML and TOML. YAML is older and
common in the Python community, but TOML is much simpler and less error-prone.
I would much rather be responsible for the <1000 lines of `tomli`, on top of
TOML being the choice of the Rust community, with robust crates for reading it.
The structure of `configitems.toml` is explained inline.