- 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.
-
Raphaël Gomès authored
Same as the previous patch, this is just dumb performance loss.
-
Raphaël Gomès authored
This is... really dumb and costs a ton of performance in a hot loop. It was 75% of a profile for a tip to null p1 node traversal in pure Rust. I'm at fault, done in 652149ed64f0. I thought clippy had a lint for this, but apparently not?
-
- 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
-
- Feb 13, 2025
-
-
Raphaël Gomès authored
The code (especially the Rust code) was jumping in 4 dimensions to make sense of what was going on because it wrongly assumed that we needed to somehow be able to ask a generaldelta index for a non-generaldelta delta chain, which doesn't make any sense. Removing the cargo-culted/vestigial code, this is cleaner and less confusing.
-
- Feb 04, 2025
-
-
Georges Racinet authored
This requires yet another `Sync` marker in `hg-core`. Of course we are leveraging the new `py_shared_iterator!` for this.
-
- Jan 29, 2025
-
-
Georges Racinet authored
Pretty straightforward with `py_shared_iterator!`.
-
Georges Racinet authored
For the purposes of providing PyO3 bindings, the data fields that will be exposed to Python have to be `Sync`, hence that is the case of `OwningDirstateMap` and its `owner` field. We had to do something similar for the PyO3 bindings of `revlog`. In this case, it forces us to adapt the `Deref` wrapper of `PyBytes` used in `hg-cpython`, because it must itself now be `Sync` and raw pointers are not. This looks even uglier than it used to, but it does not matter much, because our ultimate goal is to remove the rust-cpython bindings altogether.
-
- Dec 25, 2024
-
-
Georges Racinet authored
This is necessary for the upcoming PyO3 bindings and does not bring any problems. In practical applications, this immutable part is often obtained by `mmap` and satisfies the requirement.
-
- Feb 07, 2025
-
-
Mitchell Kember authored
This makes AncestorsIterator store its set of seen revisions in a BitSet-based DescendingRevisionSet instead of a HashSet. This provides faster lookups and insertions, and uses only A - B bits of memory when iteration goes from revision A down to revision B. In the worst case iterating from tip to -1 in the mercurial-devel changelog, for example, it would use about 7 KiB. Running rhg annotate on 200 random files in mercurial-devel gave on average a 10% improvement. Here is the distribution: new/old freq histogram -------- |----- | --------- 0.81 | 17 | ** 0.84 | 32 | **** 0.87 | 23 | *** 0.90 | 24 | *** 0.92 | 20 | *** 0.95 | 34 | ***** 0.98 | 18 | ** 1.01 | 24 | *** 1.04 | 3 | 1.07 | 5 | -------- |----- | --------- Avg=0.90 |N=200 |
-
Mitchell Kember authored
This will be used in a follow-up commit that creates a data structure optimized for inserting revisions in descending order, since it will need to fail if a revision number is greater than its descendant (meaning the graph is corrupted).
-
Mitchell Kember authored
This is in preparation for adding a new kind of GraphError.
-
- 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.
-
Raphaël Gomès authored
In contexts where we access the same revlog from multiple threads (like in `annotate`), multiple threads would lock the handle, then read from a different place that they would expect, since the `seek` behavior of the `InnerRevlog` was written with single threaded access in mind.
-
Raphaël Gomès authored
We need to make `InnerRevlog` `Sync`, since we want to iterate on and read it in parallel. An uncontended `RwLock` has no measurable overhead over a `RefCell` in our contexts (to be verified in benchmarks, but I'm pretty sure). This change assumes that writes/reads to/from the uncompressed chunk cache can fail if contended, since it's just a cache, but the rest of operations (which are on FileHandles) should wait for the lock and bubble up the panic in case of lock poisoning. If a program tries to write from multiple threads to a revlog, it had better have good reasons, so I'm not too worried.
-
Raphaël Gomès authored
This has always been ok to be `Sync` in all of our contexts, we've just never needed to make it explicit. Now that we're starting to do more things in parallel, let's add the bound in a new type alias to avoid repetition.
-
- Jan 16, 2025
-
-
Mitchell Kember authored
There was some code that converted Revision to UncheckedRevision with .into() before calling a method. This change removes the .into() and calls the corresponding method for Revision instead.
-
Mitchell Kember authored
This continues the work done in a3fa37bdb7ec, turning more methods into checked/unchecked pairs of methods.
-
- Jan 14, 2025
-
-
Mitchell Kember authored
This is similar to manifestctx.read_delta_parents(exact=False) in manifest.py. It is useful to determine if a file was added in a changeset without delta-resolving the entire manifest. I will use it for rhg annotate.
-
- Jan 16, 2025
-
-
Mitchell Kember authored
This moves string-related functions in hg::utils into the recently added hg::utils::strings module.
-
- Jan 03, 2025
-
-
Mitchell Kember authored
This is intended for code similar to stringutil.py. This commit adds one method, short_user, which will be needed for rhg annotate.
-
Mitchell Kember authored
These will be needed for the implementation of rhg annotate.
-
Mitchell Kember authored
This matches Changelog and Manifestlog. I need to access the revlog for the implementation of rhg annotate.
-
- 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.
-
- Dec 18, 2024
-
-
Mitchell Kember authored
I wrote C FFI bindings manually rather than using a bindgen build step because there are only 2 structs and 3 functions and they're not going to change. Note that the relative path in build.rs means that cargo publish will no longer work. If in the future we want to publish to crates.io, we would probably need to add a Makefile step that copies bdiff sources into the hg-core crate.
-
- Jan 29, 2025
-
-
Arseniy Alekseyev authored
Apparently we "return" instead of doing "continue", which seems clearly unintentional. I split the function in two to make this particular bug impossible.
-
- Jan 28, 2025
-
-
Arseniy Alekseyev authored
Do the same whitespace-at-the-edge validation in rhg that we do in Python.
-
- Jan 21, 2025
-
-
Mitchell Kember authored
This ensures that revlogs only use mmap when revlog.mmap.index is true (or defaulted to true based on can_populate_mmap()). This config previously had no effect because the code in its if-branch was accidentally duplicated below.
-
- Jan 14, 2025
-
-
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).
-
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).
-
- 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 06, 2024
-
-
Arseniy Alekseyev authored
Rework how we convert patterns to regexes in rust. Instead of going patterns -> string -> Regex, which is slow and causes some correctness issues, build a structured regex_syntax::hir::Hir value, which is faster and it also prevents surprising regex escape. This change makes the time of `build_regex_match` go from ~70-80ms to ~40ms in my testing (for a large hgignore). The bug I mentioned involves regex patterns that "escape" their intended scope. For example, a sequence of hgignore regexp patterns like this would previously lead to surprising behavior: foo(?: bar baz ) this matches foobar and foobaz, and doesn't match bar and baz. The new behavior is to report a pattern parse error The Python hg also has this bug, so this bugfix not really helping much, but it's probably better to fall back to real Python bugs than to simulate them.
-
- Dec 05, 2024
-
-
Arseniy Alekseyev authored
This continues the theme of a48c688d3e80, and fixes the bug #6375, which was causing some problems for us, where a non-group-readable file can't be copied, which breaks some tools that copy the repo. This affects both the `checkexec` file and the temporary file we use for filesystem time measurement, since either of these files remaining on disk can cause this problem, and the 0666 permissions are just the better default here.
-
- 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 adds methods to FilelogRevisionData to extract the metadata header. The header is represented by a &[u8] wrapper capable of parsing the fields "censored", "copy", and "copyrev". This will be needed for supporting --copies in rhg status and diff.
-
Arseniy Alekseyev authored
-
- Dec 02, 2024
-
-
Arseniy Alekseyev authored
I think this makes it easier to understand the purpose of this extra argument.
-
- Nov 27, 2024
-
-
Arseniy Alekseyev authored
This is what Python code does, and users in multiuser environments rely on this behavior. (we've been maintaining a private patch that fixes this for a long time)
-
- 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).
-