Skip to content
Snippets Groups Projects
  1. Feb 14, 2025
    • Mitchell Kember's avatar
      rust-config: add username parsing · 879029f0
      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.
      879029f0
  2. Jan 16, 2025
  3. Jan 14, 2025
    • Mitchell Kember's avatar
      hg-core: fix usage.resources default logic · 72deeea2
      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).
      72deeea2
    • Mitchell Kember's avatar
      hg-core: fix usage.resources typo · 6499af83
      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).
      6499af83
  4. Nov 04, 2024
  5. Oct 01, 2024
  6. Jun 19, 2024
  7. Nov 06, 2023
    • Raphaël Gomès's avatar
      rust: run a clippy pass with the latest stable version · 532e74ad
      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.
      532e74ad
  8. Aug 09, 2023
    • Raphaël Gomès's avatar
      rust-config: fix incorrect coercion of null values to false · 8343947a
      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.
      8343947a
    • Raphaël Gomès's avatar
      rust-config: show default `null` is coerced incorrectly to `false` · 10e57e3f
      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.
      10e57e3f
    • Raphaël Gomès's avatar
      rust-config: fix fallback to default not parsing the default value · 58390f59
      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.
      58390f59
  9. Aug 08, 2023
  10. Jul 12, 2023
  11. Jul 06, 2023
  12. Jul 05, 2023
    • Raphaël Gomès's avatar
      configitems: move blackbox's config items to the new configitems.toml · 7f8f6fe1
      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.
      7f8f6fe1
  13. Feb 13, 2023
  14. Jul 06, 2023
    • Raphaël Gomès's avatar
      rust-config: add support for default config items · f8412da8
      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`.
      f8412da8
  15. Feb 27, 2023
  16. Jan 12, 2023
  17. Jan 10, 2023
  18. Jan 09, 2023
    • Raphaël Gomès's avatar
      rust-clippy: fix most warnings in `hg-core` · e98fd81b
      Raphaël Gomès authored
      All of these are simple changes that for the most part are clear improvements
      and the rest are at most equivalent.
      
      The remaining warnings have to be fixed either with a bigger refactor like for
      the nested "revlog" module, or in the dependency `bytes-cast`, which we own.
      
      This will be done sometime in the future.
      e98fd81b
  19. Nov 14, 2022
  20. Sep 20, 2022
  21. Sep 22, 2022
  22. Sep 20, 2022
  23. Jul 19, 2022
  24. Feb 10, 2022
  25. Dec 10, 2021
  26. Nov 26, 2021
  27. Nov 09, 2021
  28. Sep 03, 2021
  29. Feb 17, 2021
    • Simon Sapin's avatar
      rhg: Port Python’s `ui.configlist` as `Config::get_list` · 6961eca0
      Simon Sapin authored
      This new method is not used yet outside of its own unit tests,
      so this changeset should make no observable change.
      
      The Rust parser implementation attempts to exactly replicate the behavior of
      the Python one, even in edge cases where that behavior is… surprising.
      New unit tests capture some of these edge cases.
      
      This started as a line-by-line port. The main changes are:
      
      * Pass around a parser mode enum instead of parser functions
      * Inline the whole parser into one function
      * Use `[u8]::get` which returns an `Option`,
        instead of indexing  after explicitly checking the length.
      
      Differential Revision: https://phab.mercurial-scm.org/D11389
      6961eca0
  30. Jun 07, 2021
  31. Apr 15, 2021
  32. Mar 19, 2021
Loading