Skip to content
Snippets Groups Projects
  1. Feb 14, 2025
    • Mitchell Kember's avatar
      rust-config: add username parsing · 879029f03324
      Mitchell Kember authored
      This adds Config::username which returns HGUSER, ui.username, or EMAIL in that
      order, similar to ui.username() in Python.
      
      I considered following the pattern of EDITOR, VISUAL, PAGER, etc. and using
      add_for_environment_variable, but it's not possible to get the same precendence
      as in Python that way (in particular HGUSER coming after the repo .hg/hgrc), at
      least not without significant changes.
      
      This will be used for 'rhg annotate -r wdir() -u' to annotate the username on
      lines that were changed in the working directory.
      879029f03324
  2. Jan 14, 2025
    • Mitchell Kember's avatar
      hg-core: fix usage.resources default logic · 72deeea26bca
      Mitchell Kember authored
      This makes hg-core use ResourceProfileValue::Medium as the default. Before, it
      used ResourceProfileValue::Default (now removed), which was not supposed to be a
      real value, but rather an indirection meaning to use the default (medium).
      
      The motivation for this is that my implementation of rhg annotate was slower on
      some files than Python. This was because Python used the "Medium" profile by
      default (enabling the revlog chunk cache), while Rust used the "Default" profile
      (disabling the revlog chunk cache).
      72deeea26bca
    • Mitchell Kember's avatar
      hg-core: fix usage.resources typo · 6499af83735a
      Mitchell Kember authored
      This makes hg-core read resource profile configs from usage.resources. Before,
      it correctly used that for sub-values such as usage.resources.memory, but for
      the generic value it incorrectly used usage.resource (singular).
      6499af83735a
  3. Jun 19, 2024
  4. Nov 06, 2023
    • Raphaël Gomès's avatar
      rust: run a clippy pass with the latest stable version · 532e74ad3ff6
      Raphaël Gomès authored
      Our current version of clippy is older than the latest stable.
      The newest version has new lints that are moslty good advice, so let's apply
      them ahead of time. This has the added benefit of reducing the noise for
      developpers like myself that use clippy as an IDE helper, as well as being
      more prepared for a future clippy upgrade.
      532e74ad3ff6
  5. Aug 09, 2023
    • Raphaël Gomès's avatar
      rust-config: fix incorrect coercion of null values to false · 8343947af6a7
      Raphaël Gomès authored
      As explained in the previous changeset:
      
      Probably being too trigger happy about boolean values, I incorrectly set
      the transform for a `None` to a `Some(false)`. It would cause for example
      the `ui.formatted` value to be set to `Some(false)`, which turns off the colors
      among other things, when `None` would trigger the automatic behavior.
      8343947af6a7
    • Raphaël Gomès's avatar
      rust-config: show default `null` is coerced incorrectly to `false` · 10e57e3f7276
      Raphaël Gomès authored
      Probably being too trigger happy about boolean values, I incorrectly set
      the transform for a `None` to a `Some(false)`. It would cause for example
      the `ui.formatted` value to be set to `Some(false)`, which turns off the colors
      among other things, when `None` would trigger the automatic behavior.
      
      This is fixed in the next commit.
      10e57e3f7276
    • Raphaël Gomès's avatar
      rust-config: fix fallback to default not parsing the default value · 58390f59826f
      Raphaël Gomès authored
      When a config item's default is a string, it sometimes needs to be parsed
      into another type, like in the case of `cmdserver.max-log-size`, that returns
      a number of bytes from a human-readable amount like `25MB`.
      
      The logic for the fix is explained inline.
      58390f59826f
  6. Aug 08, 2023
  7. Jul 12, 2023
  8. Jul 06, 2023
  9. Jul 05, 2023
    • Raphaël Gomès's avatar
      configitems: move blackbox's config items to the new configitems.toml · 7f8f6fe13fa9
      Raphaël Gomès authored
      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.
      7f8f6fe13fa9
  10. Feb 13, 2023
  11. Jul 06, 2023
    • Raphaël Gomès's avatar
      rust-config: add support for default config items · f8412da86d05
      Raphaël Gomès authored
      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`.
      f8412da86d05
  12. Feb 27, 2023
  13. Jan 12, 2023
  14. Jan 10, 2023
  15. Sep 22, 2022
  16. Sep 20, 2022
  17. Feb 10, 2022
  18. Apr 10, 2021
    • Pulkit Goyal's avatar
      rhg: read [paths] for `--repository` value · ebdef6283798
      Pulkit Goyal authored
      hg parses `-R` and `--repository` CLI arguments "early" in order to know which
      local repository to load config from. (Config can then affect whether or how to
      fall back.)
      
      The value of of those arguments can be not only a filesystem path, but also an
      alias configured in the `[paths]` section. This part was missing in rhg and
      this patch implements that.
      
      The current patch still lacks functionality to read config of current repository
      if we are not at root of repo. That will be fixed in upcoming patches.
      
      A new crate `home` is added to get path of home directory.
      
      Differential Revision: https://phab.mercurial-scm.org/D10296
      ebdef6283798
  19. Feb 17, 2021
  20. Feb 16, 2021
    • Simon Sapin's avatar
      rust: Add a `ConfigValueParseError` variant to common errors · bc08c2331f99
      Simon Sapin authored
      Configuration files are parsed into sections of key/value pairs when
      they are read, but at that point values are still arbitrary bytes.
      Only when a value is accessed by various parts of the code do we know
      its expected type and syntax, so values are parsed at that point.
      
      Let’s make a new error type for this latter kind of parsing error,
      and add a variant to the common `HgError` so that most code can propagate it
      without much boilerplate.
      
      Differential Revision: https://phab.mercurial-scm.org/D10009
      bc08c2331f99
  21. Feb 04, 2021
  22. Dec 29, 2020
    • Raphaël Gomès's avatar
      hg-core: add basic config module · 95d6f31e88db
      Raphaël Gomès authored
      The config module exposes a `Config` struct, unused for now.
      
      It only reads the config file local to the repository, but handles all valid
      patterns and includes/unsets.
      It is structured in layers instead of erasing by reverse order of precedence,
      allowing us to transparently know more about the config for debugging purposes,
      and potentially other things I haven't thought about yet.
      
      This change also introduces `format_bytes!` to `hg-core`.
      
      Differential Revision: https://phab.mercurial-scm.org/D9408
      95d6f31e88db
Loading