- 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 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.
-
Arseniy Alekseyev authored
The flag controls if the printed regex is intended to cover everything (including the individually mentioned files), or just the regex that's used in matching.
-
Arseniy Alekseyev authored
-
- Nov 26, 2024
-
-
Arseniy Alekseyev authored
The conversion already exists in rhg, where we need to convert to CommandError. This commit moves it to hg core. This makes it easier to code some middleware where we need to carry around a type that represents any type of hg error (HgError).
-
Arseniy Alekseyev authored
This brings the work started in `652149ed64f0` to its logical conclusion and makes the RevlogError self-sufficient so it can be directly converted to CommandError, without an extra rev text annotation. Without this change, it's confusing that the extra annotation is ignored in most-but-not-all cases.
-
- Dec 02, 2024
-
-
Mitchell Kember authored
This changes how rhg status avoids printing copies with --no-status. Originally 668a871454e8 added a check right before printing copies. This changes it to match Python and check it earlier by defining `list_copies = ... && !no_status`. This makes no difference now, but when we implement --rev --rev --copies it will ensure we don't do wasteful copy tracing when it's not going to be printed.
-
- Nov 25, 2024
-
-
Mitchell Kember authored
This makes `rhg st --rev A --rev B --no-copies` work without fallback to Python, where previously `--config ui.statuscopies=False` was necessary.
-
- Nov 04, 2024
-
-
Raphaël Gomès authored
It is fully replaced with the now stable `std::io::IsTerminal` trait. This was the last dependency flagged as a warning by `cargo audit`, aside from `cpython` which we know about all too well: the plan is to transition to PyO3 soon-ish.
-
Raphaël Gomès authored
This only muddies the lib and makes the imports more confusing.
-
Raphaël Gomès authored
This is where it belongs
-
Raphaël Gomès authored
That's where they belong and should always have been there.
-
Raphaël Gomès authored
This was done very early in the Rust project's lifecycle and I had very little Rust experience. Let's keep the `DirstateParents` since they'll pop up in all higher-level code and make the rest more explicit imports to make the imports less confusing and the lib less cluttered.
-