D12317: dirstate-tree: optimize HashMap lookups with raw_entry_mut

2022-03-03 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This switches to using `HashMap` from the hashbrown crate, in order to use its `raw_entry_mut` method. The standard library’s `HashMap` is also based

D12316: rust: enable Python 3 support unconditionally

2022-03-02 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Note: `cpython/python3-sys` is a default feature. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12316

D12175: status: prefer relative paths in Rust code

2022-02-14 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY … when the repository root is under the current directory, so the kernel needs to traverse fewer directory in every call to `read_dir` or `symlink_metadata

D12174: rust: remove unused `StatusError::IO` enum variant

2022-02-14 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY All `io::Error` cases are now handled through PatternFileWarning or BadMatch REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https

D12173: rust: fix code formatting

2022-02-14 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12173 AFFECTED FILES rust/rhg/src/commands/status.rs CHANGE DETAILS diff

D12167: [WIP] rhg: Add support for colored output

2022-02-10 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY The same "label" system is used as in Python code REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.

D12168: [WIP] rhg: Colorize `rhg status` output when appropriate

2022-02-10 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12168 AFFECTED FILES rust/rhg/src/commands/status.rs rust/rhg/src/main.rs

D12166: rhg: Add parsing for the --color global CLI argument

2022-02-10 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12166 AFFECTED FILES rust/hg-core/src/config/config.rs rust/hg-core/src

D12164: rhg: Pass a to Ui::new

2022-02-10 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY When a Ui object is needed to print errors about configuration-loading errors, an empty (default) configuration is used. REPOSITORY rHG Mercurial BRANCH

D12165: rhg: Make Ui::new falliable, add Ui::new_infallible

2022-02-10 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This allows propagating color configuration errors REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12165

D12163: rhg: Add support for HGPLAINEXPECT

2022-02-10 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12163 AFFECTED FILES rust/rhg/src/commands/status.rs rust/rhg/src/main.rs

D12162: rhg: enable `rhg status` by default, without config or env opt-in

2022-02-10 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY The full test suite now passes with `hg` pointing to rhg. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org

D12003: rust: Fix outdated comments in OwningDirstateMap

2022-01-17 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY OwningDirstateMap used to own a PyBytes, but was generalized to be more generic when it was moved from hg-cpython to hg-core. This fixes some comments

D11965: rhg: desambiguate status without decompressing filelog if possible

2022-01-06 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY When status is unsure based on `stat()` and the dirstate if a file is clean or modified, we need to compare it against the filelog. This comparison can

D11963: rhg: Store p1, p2, and hash in RevlogEntry

2022-01-06 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This avoids a duplicate index lookup REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D11963 AFFECTED FILES

D11960: rhg: Add RevlogEntry::data that does delta resolution

2022-01-06 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This requires keeping a `` reference inside the `RevlogEntry` struct. This struct already had the appropriate lifetime parameter. REPOSITORY rHG Mercurial

D11964: filelog: add a comment explaining a fast path in filerevisioncopied()

2022-01-06 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D11964 AFFECTED FILES mercurial/utils/storageutil.py CHANGE DETAILS diff --git

D11959: rhg: Rename some revlog-related types and methods

2022-01-06 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Use "data chunck" and "data" for a revlog entry’s data before and after resolving deltas (if any), repsectively. The former `Filelog

D11961: rhg: Expose FilelogEntry that wraps RevlogEntry

2022-01-06 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This can be later extended to access metadata such as `uncompressed_len` without necessarily resolving deltas. REPOSITORY rHG Mercurial BRANCH default

D11962: rhg: RevlogEntry::uncompressed_len is signed

2022-01-06 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY The corresponding Python code appears to explicitly check for non-negative values. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https

D11943: rhg: Fall back to Python if verbose status is requested by config

2021-12-18 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D11943 AFFECTED FILES rust/rhg/src/commands/status.rs rust/rhg/src/ui.rs

D11942: rhg: Accept different "invalid ignore pattern" error message formatting

2021-12-17 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY At the moment rhg compiles all patterns into a single big regular expression, so it’s not practical to find out which file the invalid bit of syntax came

D11940: rhg: Sub-repositories are not supported

2021-12-17 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D11940 AFFECTED FILES rust/hg-core/src/repo.rs rust/rhg/src/main.rs tests

D11941: rhg: Properly format warnings related to ignore patterns

2021-12-17 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D11941 AFFECTED FILES rust/rhg/src/commands/status.rs CHANGE DETAILS diff

D11939: dirstate-v2: Apply SECOND_AMBIGUOUS to directory mtimes too

2021-12-17 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This would only be relevant in contrived scenarios such as a dirstate file being written with a libc that supports sub-second precision in mtimes

D11938: rust: Upgrade to format-bytes 0.3

2021-12-17 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This removes use of the proc-macro-hack crate, which is possible now that we’ve don’td support Rust 1.41 to 1.44 anymore. This in turn fixes spurious

D11932: rhg: Use binary search in manifest lookup

2021-12-16 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY … instead of linear scan, when looking for a single entry based on its path. Manifest entries are sorted by path, but are variable-size so we can’t use

D11910: rhg: Skip reading the contents of ambiguous files in some cases

2021-12-14 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY If the size of the file in the working directory does not match the length of the filelog data, we know its contents will be different and don’t need

D11909: rhg: Mark it as expected that the issue6528 bug is not reproduced

2021-12-14 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D11909 AFFECTED FILES tests/test-issue6528.t CHANGE DETAILS diff --git a/tests

D11908: rhg: Print "bad match" errors in rhg status

2021-12-13 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Previously these would only be visible if enabled with some RUST_LOG environment variable. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL

D11907: rhg: Add support for ui.ignore and ui.ignore.* config

2021-12-13 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This fixes some but not all failures in `tests/test-hgignore.t` when running with `rhg status` enabled. REPOSITORY rHG Mercurial BRANCH default

D11899: rhg: Add support for `rhg status --copies`

2021-12-10 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Copy sources are collected during `status()` rather than after the fact like in Python, because `status()` takes a `` exclusive reference to the dirstate

D11900: tests: add a short `sleep` in test-status.t

2021-12-10 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY With dirstate-v2 and rhg both enabled, this test would sometimes fail for me with: --- tests/test-status.t +++ tests/test-status.t#dirstate-v2.err

D11898: rhg: refactor relativize_path into a struct + method

2021-12-10 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY … instead of a function that takes an iterator and a callback. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org

D11897: rhg: refactor display_status_paths with a struct for common arguments

2021-12-10 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D11897 AFFECTED FILES rust/rhg/src/commands/status.rs CHANGE DETAILS diff

D11890: rhg: Add support for ui.ignore and ui.ignore.* config

2021-12-09 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This fixes some but not all failures in `tests/test-hgignore.t` when running with `rhg status` enabled. REPOSITORY rHG Mercurial BRANCH default

D11889: rhg: Set second_ambiguous as needed in post-status fixup

2021-12-09 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This fixes an intermittent bug that manifested only in test-revert.t, and unfortunately not on CI. On a fast enough machine we could have: 1. A file

D11888: dirstate: Document Timestamp.second_ambiguous

2021-12-09 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D11888 AFFECTED FILES mercurial/dirstateutils/timestamp.py CHANGE DETAILS diff

D11840: rhg: Update the dirstate on disk after status

2021-12-02 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D11840 AFFECTED FILES rust/hg-core/src/dirstate/entry.rs rust/rhg/src/commands

D11839: rhg: Add Repo::write_dirstate

2021-12-02 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This method is not used yet. It saves to disk any mutation that was done to the `Repo`’s dirstate through `Repo::dirstate_map_mut`. It takes care

D11835: rhg: Initial repository locking

2021-12-02 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Initial Rust implementation of locking based on the `.hg/wlock` symlink (or file), with lock breaking when the recorded pid and hostname show that a lock

D11834: rust: Serializing a DirstateMap does not mutate it anymore

2021-12-02 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D11834 AFFECTED FILES rust/hg-core/src/dirstate_tree/dirstate_map.rs rust/hg

D11836: rust: Add Vfs::write_atomic

2021-12-02 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This method writes to a temporary file then renames in place REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org

D11837: rhg: Make Repo::dirstate_parents a LazyCell

2021-12-02 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Unify with the same abstraction used for other lazily-initialized components REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https

D11815: rhg: Add support for `rhg status -n`

2021-11-26 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY The `RHG_STATUS=1` bit added here can be removed when `unset RHG_STATUS` near the top of the file is removed. REPOSITORY rHG Mercurial BRANCH default

D11774: rhg: Fix status desambiguation of symlinks and executable files

2021-11-23 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D11774 AFFECTED FILES rust/hg-core/src/dirstate/entry.rs rust/hg-core/src

D11771: rhg: Propogate manifest parse errors instead of panicking

2021-11-23 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY The Rust parser for the manifest file format is an iterator. Now every item from that iterator is a `Result`, which makes error handling required

D11772: rhg: Also parse flags in the manifest parser

2021-11-23 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D11772 AFFECTED FILES rust/hg-core/src/operations/cat.rs rust/hg-core/src

D11773: rhg: Rename cat_file_is_modified

2021-11-23 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY It hasn’t been based on the "cat operation" for some time already. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab

D11769: tests: Adapt test-basic.t expected output for rhg

2021-11-19 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D11769 AFFECTED FILES tests/test-basic.t CHANGE DETAILS diff --git a/tests

D11762: rhg: Colored output is not supported

2021-11-15 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Fallback if it is requested explicitly. The default is documented as use color "whenever it seems possible". rhg proceeds without color in

D11761: rhg: [encode] and [decode] config sections are not supported

2021-11-15 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D11761 AFFECTED FILES rust/hg-core/src/config/config.rs rust/hg-core/src

D11760: rhg: Config commands.status.terse is not supported

2021-11-15 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D11760 AFFECTED FILES rust/rhg/src/commands/status.rs tests/test-status

D11759: rhg: Propagate config errors in `rhg status`

2021-11-15 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This code was calling `Result::unwrap_or` instead of `Option::unwrap_or` as was presumably intended. REPOSITORY rHG Mercurial BRANCH default REVISION

D11758: rhg: $HG_PENDING is not supported

2021-11-15 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Trigger fallback in that case, if configured to do so. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D11758

D11756: rhg: Enable `rhg status` in most tests

2021-11-15 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This subcommand is disabled by default because of bugs that make some test fail. Enable it in the rest of the tests in order to avoid regressing them

D11743: rhg: Fix `rhg status` file content comparison

2021-11-09 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This is only used when a file’s metadata make its status ambiguous, which depends on timing of previous command executions. REPOSITORY rHG Mercurial

D11696: rust: Remove now-unused DirstateEntry::clear_ambiguous_mtime method

2021-10-19 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D11696 AFFECTED FILES rust/hg-core/src/dirstate/entry.rs CHANGE DETAILS diff

D11691: dirstate: rename a `very_likely_equal` method to `likely_equal`

2021-10-19 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY No need to oversell it. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D11691 AFFECTED FILES rust/hg-core

D11684: dirstate: Store mtimes with nanosecond precision in memory

2021-10-18 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Keep integer seconds since the Unix epoch, together with integer nanoseconds in the `0 <= n < 1e9` range. For now, nanoseconds are still alway

D11678: rust: reformat Rust code

2021-10-15 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY (cd rust && cargo +nightly fmt) REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D11678 AFFECTED FILE

D11662: dirstate-v2: Separate HAS_FILE_MTIME and HAS_DIRECTORY_MTIME flags

2021-10-14 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Previously the same flag was used, with its meaning based on whether the node otherwise identifies a file tracked anywhere. In addition to being more

D11661: dirstate-v2: Extend node flags to 16 bits

2021-10-14 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Only 7 out of 8 available bits are used right now. Reserve some more. Future versions of Mercurial may assign meaning to some of these bits

D11660: dirstate-v2: Use attributes as intended instead of properties in v2_data()

2021-10-14 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY The property return other integer values instead of None, so `is not None` does not work. This fixes test-dirstate-race.t in pure-Python mode, which

D11658: dirstate: Remove unused variable

2021-10-14 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This fixes test-check-pyflakes.t which is currently failing on the default branch. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https

D11657: rust: Reformat source code

2021-10-14 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This fixes test-check-rust-format.t which is currently failing on the default branch. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https

D11655: dirstate-v2: Add storage space for nanoseconds precision in file mtimes

2021-10-13 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY For now the sub-second component is always set to zero for tracked files and symlinks. (The mtime of directories for the `readdir`-skipping optimization

D11654: status: Extract TruncatedTimestamp from fs::Metadata without SystemTime

2021-10-13 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY On Unix, the Rust standard library exposes `mtime` and `mtime_nsec` methods for `std::fs::Metada` whih is exactly what we need to construct

D11633: dirstate-v2: Truncate directory mtimes to 31 bits of seconds

2021-10-12 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY … instead of 64 bits, while keeping the sub-second presision. This brings the size of one timestamp from 12 bytes to 8 bytes. 31 bits is chosen instead

D11635: dirstate-v2: Replace the 32-bit `mode` field with two bits

2021-10-12 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Previously we stored the entire value from `stat_result.st_mode`, like dirstate-v1 does. However only the executable permission and type of file (only

D11632: dirstate-v2: Separate Rust structs for Timestamp and PackedTimestamp

2021-10-12 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY PackedTimestamp is now exclusively for dirstate-v2 serialization purpose. It contains unaligned big-endian integers. Timestamp is used everywhere else

D11634: dirstate-v2: Store unsigned integers inside DirstateEntry

2021-10-12 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY The negative marker values are not used anymore. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D11634

D11631: dirstate-v2: Only convert from SystemTime to Timestamp and not back

2021-10-12 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Converting from Timestamp back to SystemTime was only used for equality comparison, but this can also be done on Timestamp values. REPOSITORY rHG

D11630: rust: update the rust-cpython crate to 0.7.0

2021-10-12 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This notably brings support for Python 3.10, and includes the panic message when propagating a Rust panic as a Python exception. https://github.com

D11629: dirstate-v2: Change the representation of negative directory mtime

2021-10-12 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Change it from how I previously thought C’s `timespec` works to how it actually works. The previous behavior was also buggy for timestamps strictly

D11625: dirstate-v2: Document flags/mode/size/mtime fields of tree nodes

2021-10-11 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This file format modification was previously left incomplete because of planned upcoming changes. Not all of these changes have been made yet

D11624: dirstate-v2: Change the representation of negative directory mtime

2021-10-11 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Change it from how I previously thought C’s `timespec` works to how it actually works. See code comments. REPOSITORY rHG Mercurial BRANCH default

D11623: dirstate-v2: Use "byte sequence" in docs

2021-10-11 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY The patch originally sent as https://phab.mercurial-scm.org/D11546 used "byte string" but that was changed during review to avoid suggesting

D11621: dirstate: Move more methods to the _dirstatemapcommon base class

2021-10-08 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This reduces duplication slightly and will help with supporting dirstate-v2 when Rust is not enabled. REPOSITORY rHG Mercurial BRANCH default REVISION

D11620: dirstate-v2: Change swap the order of size and mtime on disk

2021-10-08 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This makes the dirstate-v2 file format match dirstate-v2 for the order of `mode`, `size`, and `mtime`. This order does not matter as long

D11618: rust: Make the hg-cpython crate default to Python 3

2021-10-08 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This default is used when running `cargo` manually such as for `cargo test`. `setup.py` and `Makefile` both configure the Python major version explicitly

D11546: dirstate-v2: Add internal documentation

2021-10-01 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY It can be viewed by running `hg help internals.dirstate-v2` Since that command rewraps paragraphs, the source text is written with semantic line breaks

D11545: dirstate-v2: Move data file info in the docket closer together

2021-10-01 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Having `data_size` next to `uuid_size` (and the UUID itself) makes more sense. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https

D11520: dirstate-v2: Add support when Rust is not enabled

2021-10-01 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This wires into `dirstatemap` the parser and serializer added in previous changesets. The memory representation is still the same, with a flat `dict

D11518: dirstate-v2: Initial Python parser

2021-10-01 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY The dirstate-v2 file format should be supported even if Rust extensions are not enabled. This changeset adds parsing code that is not used yet. REPOSITORY

D11519: dirstate-v2: Initial Python serializer

2021-10-01 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This adds code seralizing a `map` and `copy_map` dicts into dirstate-v2 file formate. This is not used yet. REPOSITORY rHG Mercurial BRANCH default

D11516: dirstate: Remove the flat Rust DirstateMap implementation

2021-09-29 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Before this changeset we had two Rust implementations of `DirstateMap`. This removes the "flat" DirstateMap so that the "tree" Dirstate

D11517: dirstate: Remove the Rust abstraction DirstateMapMethods

2021-09-29 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This Rust trait used to exist in order to allow the DirstateMap class exposed to Python to be backed by either of two implementations: one similar

D11507: dirstate: drop all logic around the "non-normal" sets

2021-09-28 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY The dirstate has a lot of code to compute a set of all "non-normal" and "from_other_parent" entries. This is all used in a s

D11502: dirstate: drop the `clearambiguoustimes` method for the map

2021-09-28 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This is no longer called anywhere. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D11502 AFFECTED FILES

D11506: dirstate: use a new `drop_merge_data` in `setparent`

2021-09-28 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY What is happening this `setparent` loop is that we remove all `merge` related information when the dirstate is moved out of a `merge` situation. So

D11505: dirstate: move parent state handling in the dirstatemap

2021-09-28 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This involves dirstatemap data mostly. Moving this one level down will remove the needs for the dirstatemap to expose some of its internals

D11504: dirstate: stop checking for path collision when adjusting parents

2021-09-28 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This was already checked at a earlier point when adding the file. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial

D11503: dirstate: drop the `_updatedfiles` set

2021-09-28 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This is a lot of book keeping for something that was only used to clear ambiguous time. Since this is no no longer in use, we can drop it. REPOSITORY rHG

D11501: dirstate: simplify the ambiguity clearing at write time

2021-09-28 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY The serialization function is already doing this, so we don't need to do it manually. We just need to propagate the right definition of "now".

D11500: dirstate: Appease pytype

2021-09-28 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY test-check-pytype.t was failing since 98c0408324e6 <https://phab.mercurial-scm.org/rHG98c0408324e6bdf9dc4d306b467167b869092d5a>: File "

D11494: dirstate: Pass the final DirstateItem to _rustmap.addfile()

2021-09-23 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Now that the Python DirstateItem class wraps a Rust DirstateEntry value, use that value directly instead of converting through v1 data + 5 booleans

D11493: dirstate: Replace dropfile with drop_item_and_copy_source

2021-09-23 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Those removing a DirstateItem and a copy source are always done together REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https

D11491: dirstate: Remove return boolean from dirstatemap.dropfile

2021-09-23 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY None of the remaining callers use it. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D11491 AFFECTED FILES

D11492: rust: Remove some obsolete doc-comments

2021-09-23 Thread SimonSapin
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY About parameters that have been removed or replaced REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D11492

  1   2   3   4   >