- 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.
-
- Mar 19, 2025
-
-
Pierre-Yves David authored
It make it easy to find the source of share.
-
- 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.
-
- 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.
-
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.
-
- Feb 25, 2025
-
-
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.
-
- 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
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.
-
Raphaël Gomès authored
This change does two things: - Replace `log` subscribers with `tracing` ones for `rhg` and `hg-pyo3` - Add a `full-tracing` cargo feature to `rhg`, `hg-pyo3` and `hg-core`. To keep this change from becoming even larger, we use the `log` compatiblity feature so our `log::*` calls and `logging_timer::` attributes still work. Future patches in this series will migrate all calls over to `tracing`. The Rust README change will be at the end of this series, and will cover the details for use.
-
Raphaël Gomès authored
This makes it a little easier to make sense of, and we're going to instrument this function for tracing in this series.
-
- Feb 26, 2025
-
-
Raphaël Gomès authored
This went unnoticed forever, I guess most users pass in `-r`.
-
- Feb 21, 2025
-
-
Mitchell Kember authored
This means that lints configured in rust/Cargo.toml will apply to all crates within the workspace. Currently there are none but I plan to add some.
-
- Feb 07, 2025
-
-
Mitchell Kember authored
This adds support to rhg annotate for all the whitespace options: -w, --ignore-all-space -b, --ignore-space-change -B, --ignore-blank-lines -Z, --ignore-space-at-eol Note that --ignore-blank-lines has no effect on annotate so it is ignored. You can see this in dagop.py _annotepair which only checks if blocks are '=' or not, whereas the effect of --ignore-blank-lines is to change some '!' into '~'. When the other 3 are combined, we use the strongest option since -w implies -b and -b implies -Z. This is not explicit in the Python implementation, but I have verified that's how it behaves.
-
- Feb 18, 2025
-
-
Pierre-Yves David authored
-
- Jan 24, 2025
-
-
Mitchell Kember authored
This initial implementation produces the same output as Python for all the files I've tried, and is usually 1.5-9x faster. The algorithm is mostly the same, but one key difference is that the Rust implementation only converts filelog revisions to changelog revisions if they will actually appear in the output. This does not support all the command line flags yet. In particular, --template, --include, --exclude, --skip, and whitespace-related flags will cause fallback to Python. Also, --rev 'wdir()' (often used by editor plugins) is not supported. There is also no pager.
-
- Jan 16, 2025
-
-
Mitchell Kember authored
This moves string-related functions in hg::utils into the recently added hg::utils::strings module.
-
- Feb 05, 2025
-
-
Mitchell Kember authored
This is based on encoding.py. It reads the environment variables HGENCODING, HGENCODINGMODE, and HGENCODINGAMBIGUOUS. Currently it only supports UTF-8 and ascii, but it could be extended to support other local encodings. Unlike Python, it assumes all internal strings are UTF-8 and does not attempt to fallback to latin-1 (or ui.fallbackencoding). Nothing is using this now, but in the future command output and error messages should transition to using it. I replaced existing calls to `utf8_to_local` and `local_to_uf8` with direct String/bytes methods since they were not logically converting between internal and local encodings. Instead, they were used (for example) when an error message happened to be stored as String but needed to be passed somewhere as bytes. The proper fix for this will be to avoid String in the first place.
-
- Feb 04, 2025
-
-
Mitchell Kember authored
This fixes the bug discovered in f0c439952ecb. The bug was introduced in 136e74c2bf8f.
-
- Jan 31, 2025
-
-
Arseniy Alekseyev authored
Before this commit, `hg status` was issuing multiple `write` syscalls per line printed, separately writing out the path and the status fragments. This change makes hg status on large number of files significantly faster, going from 1.8s to 1.2s in one case. This requires adding the color information to `StdoutBuffer`, and moving the formatting functions from ui to it. I made `StdoutBuffer` generic over the underlying writer, without insisting on BufWriter, because I anticipated the need to use it with both full-buffered and line-buffered writers. That didn't end up being necessary, but I think the code is still better this way.
-
- Jan 28, 2025
-
-
Arseniy Alekseyev authored
Do the same whitespace-at-the-edge validation in rhg that we do in Python.
-
- Dec 30, 2024
-
-
Arseniy Alekseyev authored
Remove the `name` field from the `SubCommand` record, make it an accessor instead, which makes the record smaller, and the macro smaller.
-
- Dec 13, 2024
-
-
Arseniy Alekseyev authored
Add a command `script::hgignore --print-re` to print the hgignore regexp. One complication is that the `rootfilesin`-only matcher doesn't use a regular expression, and the existing converts it to something that's not a regular expression. We add code to handle that case. Since this command is now sufficient to generate a tidy-looking regexp for scripting, this frees up the "debug" command to report the internal regexp used by the regex engine, so we make that change too.
-
- Dec 16, 2024
-
-
Mitchell Kember authored
Extracted logic for resolving `FILE ...` arguments from cat.rs into a new function in path_utils.rs. I plan to use this for rhg annotate. I tried to reuse hg::utils::files::canonical_path instead, but that didn't work. For example it reports a InsideDotHg error for any path containing "..".
-
- Dec 13, 2024
-
-
Arseniy Alekseyev authored
The previous commit made it easier (too easy) to define commands with identical names. It turns out `clap` does nothing to detect such collisions, which also leads to very confusing behavior. This change catches that error, and reports where the commands came from.
-
Arseniy Alekseyev authored
Before this patch there are 2 things the user controls: 1. the module/command name, specified in subcommand! macro 2. the command name, specified in clap::command! macro If these are out of sync, we get no compile error or a clear runtime error, but instead a confusing behavior where command line parser parses one thing, but running it doesn't work. This commit makes the clap::command! macro the sole authority determining the command name, so we don't have to worry about this weird behavior any more. It also makes it easy to validate agreement between (1) and (2) if we want it, but I didn't add the check because I'm not sure people necessarily want it.
-
Arseniy Alekseyev authored
Reduce the scope of the macro to only generate individual `SubCommand` values. This way, it will be easy to tweak the behavior of `add_subcommand_args` and `subcommand_run_fn` without having to understand the details of the macro. It also lets us easy add commands that don't fit the idiom, for example the "admin::" commands or "script::" commands.
-
- Dec 03, 2024
-
-
Mitchell Kember authored
It works by parsing copy information from filelog metadata headers. The --rev --rev --copies case still falls back to Python since that will require constructing a map like pathcopies does in copies.py. As in Python, rhg by default only reports copies for newly added files. With devel.copy-tracing.trace-all-files=True, it also does it for modified files.
-
Mitchell Kember authored
This is in preparation for a follow-up changeset that will implement rhg status --change.
-
Mitchell Kember authored
The fix was simply to move up the block of code that initializes the matcher from the arguments.
-