Thu, 02 Sep 2021 02:44:12 +0200 dirstate: move the copymap drop inside dropfile
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 02 Sep 2021 02:44:12 +0200] rev 47970
dirstate: move the copymap drop inside dropfile Since the copymap is part of the dirstatemap it make more sense for the dirstatemap to manage it directly. This is part of a generic effort to move unified logic at lower level and to clean up higher level API. Differential Revision: https://phab.mercurial-scm.org/D11417
Tue, 14 Sep 2021 18:25:51 +0200 rust: Rename get_node methods to data_for_node, get_rev to data_for_rev
Simon Sapin <simon.sapin@octobus.net> [Tue, 14 Sep 2021 18:25:51 +0200] rev 47969
rust: Rename get_node methods to data_for_node, get_rev to data_for_rev These are respective methods of Changelog, Manifestlog, and Filelog; three Rust structs that that wrap a Revlog struct. This rename clarifies that node IDs or revision numbers are parameters, not return values. Also reword doc-comments in Manifestlog and Filelog to separate node IDs and revision numbers that are local to a given (non-changelog) revlog from those of a changeset. Differential Revision: https://phab.mercurial-scm.org/D11416
Tue, 14 Sep 2021 18:10:35 +0200 rust: Rename the `Revlog::get_node_rev` method to `rev_from_node`
Simon Sapin <simon.sapin@octobus.net> [Tue, 14 Sep 2021 18:10:35 +0200] rev 47968
rust: Rename the `Revlog::get_node_rev` method to `rev_from_node` This better describes the input and outputs of this method. Also rewrite the doc-comment, which seemed to have been left from copy-paste of another method. Differential Revision: https://phab.mercurial-scm.org/D11415
Tue, 14 Sep 2021 18:07:11 +0200 rust: Make private the `index` field of the `Revlog` struct
Simon Sapin <simon.sapin@octobus.net> [Tue, 14 Sep 2021 18:07:11 +0200] rev 47967
rust: Make private the `index` field of the `Revlog` struct To replace the previous use of this field from another module, add a `node_from_rev` method. This is the same method that already existed on `Changelog`. Differential Revision: https://phab.mercurial-scm.org/D11414
Mon, 26 Jul 2021 10:26:45 +0200 dirstate-v2: Remove the `.d` suffix in data file names
Simon Sapin <simon.sapin@octobus.net> [Mon, 26 Jul 2021 10:26:45 +0200] rev 47966
dirstate-v2: Remove the `.d` suffix in data file names It could cause confusion since `.d` is already used for revlogs. This suffix is not necessary since there is already a `dirstate.` prefix. Differential Revision: https://phab.mercurial-scm.org/D11413
Mon, 13 Sep 2021 18:48:48 +0200 rhg: Don’t compare ambiguous files one byte at a time
Simon Sapin <simon.sapin@octobus.net> [Mon, 13 Sep 2021 18:48:48 +0200] rev 47965
rhg: Don’t compare ambiguous files one byte at a time Even though the use of `BufReader` reduces the number of syscalls to read the file from disk, `.bytes()` yields a separate `Result` for every byte. Creating those results and dispatching on them is most likely costly. Instead, this commit opts for simplicity by reading the entire file into memory and comparing a single pair of byte strings. Note that memory already needs to contain the entire previous contents of the file, as read from the filelog. So with an extremely large file this doubles memory use but does not make it grow by orders of magnitude. At first I wrote code that still avoids reading the entire file into memory and compares one buffer at a time with `BufReader`. Find this code below for posterity. However its correctness is subtle. I ended up preferring the simplicity of the obviously-correct single comparison. ```rust let mut reader = BufReader::new(fobj); let mut expected = &contents_in_p1[..]; loop { let buf = reader.fill_buf().when_reading_file(&fs_path)?; if buf.is_empty() { // Found EOF return Ok(expected.is_empty()); } else if let Some(rest) = expected.drop_prefix(buf) { // What we read so far matches the expected content, continue reading let buf_len = buf.len(); reader.consume(buf_len); expected = rest } else { // Found different content return Ok(false); } } ``` Differential Revision: https://phab.mercurial-scm.org/D11412
Mon, 13 Sep 2021 18:09:10 +0200 rhg: Reuse manifest when checking status of multiple ambiguous files
Simon Sapin <simon.sapin@octobus.net> [Mon, 13 Sep 2021 18:09:10 +0200] rev 47964
rhg: Reuse manifest when checking status of multiple ambiguous files When `rhg status` cannot determine whether a file is clean based on mtime and size alone, it needs to compare its contents with those found in the parent commit. Previously, rhg would find the (same) manifest of that commit again for every such file. This is lifted out of the loop and reused. Differential Revision: https://phab.mercurial-scm.org/D11411
Mon, 13 Sep 2021 18:02:45 +0200 rust: Return HgError instead of RevlogError in revlog constructors
Simon Sapin <simon.sapin@octobus.net> [Mon, 13 Sep 2021 18:02:45 +0200] rev 47963
rust: Return HgError instead of RevlogError in revlog constructors This leaves fewer cases for callers to handle, as RevlogError is more general Differential Revision: https://phab.mercurial-scm.org/D11410
Mon, 13 Sep 2021 17:23:42 +0200 rhg: Align with Python on some revset parsing corner cases
Simon Sapin <simon.sapin@octobus.net> [Mon, 13 Sep 2021 17:23:42 +0200] rev 47962
rhg: Align with Python on some revset parsing corner cases In particular: * A string of ASCII digits can be either an integer on a hex prefix * The NULL node ID should convert to the NULL revision number Differential Revision: https://phab.mercurial-scm.org/D11409
Mon, 13 Sep 2021 15:42:39 +0200 rust: Add a Filelog struct that wraps Revlog
Simon Sapin <simon.sapin@octobus.net> [Mon, 13 Sep 2021 15:42:39 +0200] rev 47961
rust: Add a Filelog struct that wraps Revlog Some filelog-specific logic is moved from code `rhg cat` into this struct where it can better be reused. Additionally, a missing end delimiter for metadata causes an error to be returned instead of being silently ignored. Differential Revision: https://phab.mercurial-scm.org/D11408
(0) -30000 -10000 -3000 -1000 -300 -100 -10 +10 +100 +300 +1000 +3000 tip