[Commented On] D12594: rust-dirstate-v2: fix the unused bytes counter when rewriting the dirstate

baymax (Baymax, Your Personal Patch-care Companion) phabricator at mercurial-scm.org
Wed May 4 14:53:08 UTC 2022


baymax added a comment.
baymax updated this revision to Diff 33350.


  ✅ refresh by Heptapod after a successful CI run (🐙 💚)
  âš  This patch is intended for stable âš 
  <img src="https://phab.mercurial-scm.org/file/data/qqhfsqwiqrmcalesyz5o/PHID-FILE-5remnsbppxl5yauxywbg/source.gif" />

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D12594?vs=33343&id=33350

BRANCH
  stable

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D12594/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D12594

AFFECTED FILES
  rust/hg-core/src/dirstate_tree/on_disk.rs
  tests/test-dirstate.t

CHANGE DETAILS

diff --git a/tests/test-dirstate.t b/tests/test-dirstate.t
--- a/tests/test-dirstate.t
+++ b/tests/test-dirstate.t
@@ -195,8 +195,7 @@
 Check that unused bytes counter is reset when creating a new docket
 
   $ hg debugstate --docket | grep unused
-  number of unused bytes: 0 (no-rust !)
-  number of unused bytes: [1-9]\d* (re) (rust known-bad-output !)
+  number of unused bytes: 0
 
 #endif
 
diff --git a/rust/hg-core/src/dirstate_tree/on_disk.rs b/rust/hg-core/src/dirstate_tree/on_disk.rs
--- a/rust/hg-core/src/dirstate_tree/on_disk.rs
+++ b/rust/hg-core/src/dirstate_tree/on_disk.rs
@@ -622,13 +622,18 @@
 
     let root_nodes = writer.write_nodes(dirstate_map.root.as_ref())?;
 
+    let unreachable_bytes = if append {
+        dirstate_map.unreachable_bytes
+    } else {
+        0
+    };
     let meta = TreeMetadata {
         root_nodes,
         nodes_with_entry_count: dirstate_map.nodes_with_entry_count.into(),
         nodes_with_copy_source_count: dirstate_map
             .nodes_with_copy_source_count
             .into(),
-        unreachable_bytes: dirstate_map.unreachable_bytes.into(),
+        unreachable_bytes: unreachable_bytes.into(),
         unused: [0; 4],
         ignore_patterns_hash: dirstate_map.ignore_patterns_hash,
     };



To: Alphare, #hg-reviewers, marmoute
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20220504/77f1f030/attachment.html>


More information about the Mercurial-patches mailing list