- Apr 07, 2025
-
-
Mitchell Kember authored
This changes all the let-else statements on FileId to instead use an exhaustive match to make it more clear that the "else" case is Wdir.
-
Mitchell Kember authored
This makes rhg annotate do ancestor checks for all filelog revs. Previously it only did so for revs that would actually appear in the output. While this often improves performance, sometimes it hurts it (in a few rare cases making it slower overall than Python). The reason is that linkrev adjustment goes in reverse topological order such that each changelog scan picks up where its child (or other descendant) left off. By skipping revs that don't appear in the output, we do fewer scans, but the scans are longer. If we do "unnecessary" ancestor checks (which are comparatively cheap), we get better descendants to start those changelog scans from. That's what this change does. Here are some poulpe benchmarks on the jane repo. The "file-with-long-history" examples were chosen by the setup script. The "was-faster-in-python" files I manually selected. The "50-random-files" is from `hg files | shuf -n50`. ### data-env-vars.name = jane ### benchmark.name = hg.command.annotate ### bin-env-vars.hg.flavor = rhg ### benchmark.variants.files-as-text = no ### benchmark.variants.follow-copies = yes ### benchmark.variants.listed = default ## benchmark.variants.files = 50-random-files.list ce5d61140f14: 167.293994 ~~~~~ 49568c6ba019: 98.502573 (-41.12%, -68.79) ## benchmark.variants.files = file-with-long-history.a ce5d61140f14: 49.005604 ~~~~~ 49568c6ba019: 24.821525 (-49.35%, -24.18) ## benchmark.variants.files = file-with-long-history.b ce5d61140f14: 48.959987 ~~~~~ 49568c6ba019: 25.059625 (-48.82%, -23.90) ## benchmark.variants.files = file-with-long-history.c ce5d61140f14: 22.892105 ~~~~~ 49568c6ba019: 21.788369 (-4.82%, -1.10) ## benchmark.variants.files = was-faster-in-python.a ce5d61140f14: 35.160262 ~~~~~ 49568c6ba019: 0.749528 (-97.87%, -34.41) ## benchmark.variants.files = was-faster-in-python.b ce5d61140f14: 34.236378 ~~~~~ 49568c6ba019: 0.559009 (-98.37%, -33.68) ## benchmark.variants.files = was-faster-in-python.c ce5d61140f14: 22.803029 ~~~~~ 49568c6ba019: 1.257608 (-94.48%, -21.55) ## benchmark.variants.files = was-faster-in-python.d ce5d61140f14: 18.779003 ~~~~~ 49568c6ba019: 0.960363 (-94.89%, -17.82) ## benchmark.variants.files = was-faster-in-python.e ce5d61140f14: 18.147231 ~~~~~ 49568c6ba019: 0.698075 (-96.15%, -17.45)
-
- Mar 03, 2025
-
-
Mitchell Kember authored
This adds support for the json template in rhg annotate. All other -T/--template values continue to fallback to Python. I matched the format of the Python output so all existing tests pass. This was not that hard to do printing JSON manually. The only thing I use serde_json for is to escape strings.
-
- Mar 06, 2025
-
-
Mitchell Kember authored
I had to restructure the annotation formatting to support multiple templates, so I split this into a separate change.
-
- Mar 18, 2025
-
-
Mitchell Kember authored
This moves around code in rust/rhg/src/commands/annotate.rs to make the refactor coming after this easier to review. I did it just by copying and pasting code, and adding a `print_output` function that contains the last half of `run`.
-
- Mar 04, 2025
-
-
Mitchell Kember authored
This will be used for rhg annotate -Tjson.
-
- Apr 14, 2025
-
-
Arseniy Alekseyev authored
In the interest of keeping the code of `main_with_result` clean, move all alias-related stuff into a separate function. Also, add a comment explaining why we think `trailing_args` behavior is good enough.
-
- Apr 01, 2025
-
-
Mitchell Kember authored
This adds rhg support for resolving aliases. It does not yet support shell aliases (starting with "!") or interpolation ("$1", "$@", etc.). It splits words in alias definitions using the shlex crate.
-
- Apr 02, 2025
-
-
Mitchell Kember authored
This matches Python behavior.
-
Mitchell Kember authored
This refactors the EarlyArgs parsing. This is motivated by a follow-up change to support aliases, since it needs to check if an alias definition has any early flags and fail if so, mentioning the flags in the error message.
-
- Apr 01, 2025
-
-
Mitchell Kember authored
This changes ConfigItem to be an indexmap::IndexMap instead of a HashMap, so that it preserves insertion order. It also changes Config::iter_section to return keys in that order (lowest to highest precedence). For all existing uses of iter_section, the order doesn't appear to matter. This is motivated by a follow-up change that will implement support for aliases in rhg, where the order of alias definitions matters.
-
- Apr 16, 2025
-
-
Pierre-Yves David authored
-
- Mar 19, 2025
-
-
Pierre-Yves David authored
It make it easy to find the source of share.
-
Pierre-Yves David authored
This will be useful to find the shared repository in `hg root`. See next changeset for usage.
-
Pierre-Yves David authored
This method allow to find a repository from an arbitrary directory. This will be useful to find the repository associated with a store.
-
- Mar 20, 2025
-
-
Raphaël Gomès authored
This was probably never a big deal in practice since we don't do any changelog modification in pure Rust yet.
-
- Apr 11, 2025
-
-
Arseniy Alekseyev authored
We saw this crash with a message like this: thread '<unnamed>' panicked at hg-core/src/dirstate/on_disk.rs:812:59: range end index 18446744073709551615 out of range for slice of length 12 I believe this indicates that there's another bug or dirstate corruption that this validation caught, since I think it wouldn't crash on valid inputs (all "children" in this context are at level two or above, so they must have a slash in their full paths, so "-1" for a slash should not overflow).
-
- Apr 10, 2025
-
-
Arseniy Alekseyev authored
It removes the code repetition of having to mention Sync in returned matchers all the time. This makes matchers a tiny bit less general because you can't have a non-Sync matcher anymore, but we don't have any examples of those, and if we ever need one we can revert this change.
-
- Mar 20, 2025
-
-
Arseniy Alekseyev authored
In the interest of making it easier to use the matchers API, be more generous when producing matchers, and be more permissive when consuming them. - Add the `Send` trait everywhere where we're returning a Boxed matcher, so the caller can be free to wrap it into an `Arc` to share between threads. - For all matcher consumers, accept an &impl instead of a dyn box so the caller is free to pass anything they want.
-
Arseniy Alekseyev authored
You can still use trait objects (and all existing code still does), but the choice of the trait object is not forced upon you by the matchers. In particular: - it's now possible to make a Send matcher and stick that into an Arc (the alternative would be to add a Send bound everywhere) - it's now possible to use borrowed matchers (the alternative would be add a lifetime bound everywhere: `Box<Matcher + 'a>`) - maybe performance is a tiny bit better (but I doubt that's measurable)
-
- Mar 14, 2025
-
-
Mitchell Kember authored
This makes rhg annotate support --follow as an alias for --file. It has been marked deprecated since 2010 (f142fa3c0a8c). However, Emacs vc-annotate still passes it, and we don't want it to fall back.
-
- Mar 20, 2025
-
-
Mitchell Kember authored
This adds support for annotating a file in wdir(). Lines that are changed in the working directory get annotated with dirstate.p1 followed by "+", as in Python. I had to change some test-annotate.t output for an edge case. If file "foo" does not exist, `hg annotate -r wdir() foo` prints a slightly different error message depending on whether "foo" was ever previously tracked. I don't think this is useful or done purposefully, so it doesn't seem worth complicating rhg annotate to behave in the same way.
-
- Feb 18, 2025
-
-
Mitchell Kember authored
The main change is to add a FormatterConfig type.
-
- Mar 20, 2025
-
-
Mitchell Kember authored
The main change is to add a RepoState type which bundles together a few things that are passed around a lot. The wdir() change adds dirstate parents to this.
-
- Feb 18, 2025
-
-
Mitchell Kember authored
This matches Python behavior and the other uses of HgError::abort. I noticed this difference in a test failure when working on 'wdir()' support.
-
- Feb 19, 2025
-
-
Mitchell Kember authored
This makes revset::resolve_single return RevisionOrWdir. Previously, it returned RevlogError::WDirUnsupported (leading to abort, not fallback) for 2147483647 and ffffffffffffffffffffffffffffffffffffffff. It did not recognize 'wdir()' itself, so that would lead to Python fallback. Now, it treats all 3 cases the same: it returns RevisionOrWdir::wdir() and lets the caller decide what to do. I changed rhg cat, files, and annotate to return HgError::unsupported in this case, since wdir is valid. I made `rhg status --change wdir()` behave the same as `rhg status`, conforming to the test in test-status.t.
-
Mitchell Kember authored
This type represents either a checked Revision or the wdir() pseudo-revision (revision 0x7fffffff, node ffffffffffffffffffffffffffffffffffffffff). You construct it with revision.into() or Revision::wdir(), and destructure it with rev.exclude_wdir() which returns Option<Revision>. I considered something like `enum RevisionOrWdir { Wdir, Revision(Revision) }`, but decided on `struct RevisionOrWdir(BaseRevision)` for a few reasons: - It's more ergonomic for the ways it actually gets used, in my opinion. - It also avoids the possibility of an invalid value Revision(0x7fffffff). - It remains 4 bytes rather than 8. - It maintains the ordering: wdir is greater than all other revisions. I'm planning to use this for 'rhg annotate -r wdir()'.
-
- Feb 14, 2025
-
-
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.
-
- Mar 03, 2025
-
-
Mitchell Kember authored
This is similar to fixws in mercurial/cext/bdiff.c, except in addition to --ignore-all-space (-w) and --ignore-space-change (-b), it also handles --ignore-ws-at-eol (-Z). Unlike the regex, it operates in-place. For files with large histories such as mercurial/commands.py, it brings the penalty of -w and -b from 25% down to around 10%. For -Z, and for files with small histories, it makes little difference. Here are some poulpe benchmarks on the mercurial repo for the stack of four changes in this merge request (!1299): ### benchmark.name = hg.command.annotate # data-env-vars.name = mercurial-devel # bin-env-vars.hg.flavor = rhg ## benchmark.variants.files = 100-random-files ## benchmark.variants.flags = default 0471bf04ddf1: 0.647526 ~~~~~ cc30bead2d61: 0.633503 (-2.17%, -0.01) ## benchmark.variants.files = 100-random-files ## benchmark.variants.flags = -Z 0471bf04ddf1: 0.649229 ~~~~~ cc30bead2d61: 0.642296 (-1.07%, -0.01) ## benchmark.variants.files = 100-random-files ## benchmark.variants.flags = -b 0471bf04ddf1: 0.675751 ~~~~~ cc30bead2d61: 0.645437 (-4.49%, -0.03) ## benchmark.variants.files = 100-random-files ## benchmark.variants.flags = -w 0471bf04ddf1: 0.678141 ~~~~~ cc30bead2d61: 0.645375 (-4.83%, -0.03) ## benchmark.variants.files = file-with-long-history.a ## benchmark.variants.flags = default 0471bf04ddf1: 1.700064 ~~~~~ cc30bead2d61: 1.695099 ## benchmark.variants.files = file-with-long-history.a ## benchmark.variants.flags = -Z 0471bf04ddf1: 1.682014 ~~~~~ cc30bead2d61: 1.697669 ## benchmark.variants.files = file-with-long-history.a ## benchmark.variants.flags = -b 0471bf04ddf1: 2.140711 ~~~~~ cc30bead2d61: 1.857253 (-13.24%, -0.28) ## benchmark.variants.files = file-with-long-history.a ## benchmark.variants.flags = -w 0471bf04ddf1: 2.127745 ~~~~~ cc30bead2d61: 1.814402 (-14.73%, -0.31) ## benchmark.variants.files = file-with-long-history.b ## benchmark.variants.flags = default 0471bf04ddf1: 0.263050 ~~~~~ cc30bead2d61: 0.263603 ## benchmark.variants.files = file-with-long-history.b ## benchmark.variants.flags = -Z 0471bf04ddf1: 0.261817 ~~~~~ cc30bead2d61: 0.263896 ## benchmark.variants.files = file-with-long-history.b ## benchmark.variants.flags = -b 0471bf04ddf1: 0.286191 ~~~~~ cc30bead2d61: 0.276698 (-3.32%, -0.01) ## benchmark.variants.files = file-with-long-history.b ## benchmark.variants.flags = -w 0471bf04ddf1: 0.282997 ~~~~~ cc30bead2d61: 0.275538 (-2.64%, -0.01) ## benchmark.variants.files = file-with-long-history.c ## benchmark.variants.flags = default 0471bf04ddf1: 0.318708 ~~~~~ cc30bead2d61: 0.318006 ## benchmark.variants.files = file-with-long-history.c ## benchmark.variants.flags = -Z 0471bf04ddf1: 0.323910 ~~~~~ cc30bead2d61: 0.318743 (-1.60%, -0.01) ## benchmark.variants.files = file-with-long-history.c ## benchmark.variants.flags = -b 0471bf04ddf1: 0.390691 ~~~~~ cc30bead2d61: 0.372053 (-4.77%, -0.02) ## benchmark.variants.files = file-with-long-history.c ## benchmark.variants.flags = -w 0471bf04ddf1: 0.407243 ~~~~~ cc30bead2d61: 0.403874 ## benchmark.variants.files = file-with-long-history.d ## benchmark.variants.flags = default 0471bf04ddf1: 0.295730 ~~~~~ cc30bead2d61: 0.269190 (-8.97%, -0.03) ## benchmark.variants.files = file-with-long-history.d ## benchmark.variants.flags = -Z 0471bf04ddf1: 0.276715 ~~~~~ cc30bead2d61: 0.271512 (-1.88%, -0.01) ## benchmark.variants.files = file-with-long-history.d ## benchmark.variants.flags = -b 0471bf04ddf1: 0.283624 ~~~~~ cc30bead2d61: 0.278003 (-1.98%, -0.01) ## benchmark.variants.files = file-with-long-history.d ## benchmark.variants.flags = -w 0471bf04ddf1: 0.286407 ~~~~~ cc30bead2d61: 0.276957 (-3.30%, -0.01) ## benchmark.variants.files = file-with-long-history.e ## benchmark.variants.flags = default 0471bf04ddf1: 0.349047 ~~~~~ cc30bead2d61: 0.331948 (-4.90%, -0.02) ## benchmark.variants.files = file-with-long-history.e ## benchmark.variants.flags = -Z 0471bf04ddf1: 0.359457 ~~~~~ cc30bead2d61: 0.334011 (-7.08%, -0.03) ## benchmark.variants.files = file-with-long-history.e ## benchmark.variants.flags = -b 0471bf04ddf1: 0.373671 ~~~~~ cc30bead2d61: 0.347020 (-7.13%, -0.03) ## benchmark.variants.files = file-with-long-history.e ## benchmark.variants.flags = -w 0471bf04ddf1: 0.374186 ~~~~~ cc30bead2d61: 0.347367 (-7.17%, -0.03)
-
Mitchell Kember authored
This is in preparation for a follow-up change that reimplements the function.
-
- Feb 25, 2025
-
-
Mitchell Kember authored
This makes clean_whitespace take a &mut Vec<u8> instead of returning Cow<[u8]>. Where before it returned Cow::Borrowed, now it is a no-op. This is in preparation for a follow-up change that reimplements clean_whitespace without regexes.
-
Mitchell Kember authored
Instead we use Option<CleanWhitespace>. This is in preparation for a follow-up change that reimplements clean_whitespace, where the None case felt awkward.
-
- Feb 10, 2025
-
-
Pierre-Yves David authored
-
Pierre-Yves David authored
This will help use to deal internally with implementation details about the metadata.
-
- Mar 05, 2025
-
-
Raphaël Gomès authored
This allows us to collect traces that include Python spans to get a better idea of where time is spent. The focus here is purely to trace span times and no other features are included, because the runtime performance impact to Python can be a lot more than one would hope. There are three cases: 1) No Rust is available, the calls to `tracing.tracer.span` are a no-op context manager and should be negligible if not run in a tight loop (otherwise you would get gc cycles etc.) 2) Rust is present, but without the `full-tracing` feature: calls to `tracing.tracer.span` do the same thing as in case 1 3) Rust is present and built with the `full-tracing` feature: calls to `tracing.tracer.span` go through to the Rust tracing system and appear in the resulting chrome tracing.
-
- Mar 04, 2025
-
-
Raphaël Gomès authored
We don't need them anymore now that we've migrated to the `tracing` ecosystem.
-
Raphaël Gomès authored
-
Raphaël Gomès authored
These trace points are very verbose, so we gate them behind the `full-tracing` feature.
-
Raphaël Gomès authored
These trace points are pretty high-level, so we don't gate them behind the `full-tracing` feature.
-
Raphaël Gomès authored
This change also normalizes the default level to be `debug`, leaving `trace` to be much more verbose (and mostly compiled-out by default). We will remove the dependencies in a separate change.
-