[Updated] D11963: rhg: Store p1, p2, and hash in RevlogEntry

SimonSapin phabricator at mercurial-scm.org
Fri Jan 7 09:54:05 UTC 2022


Closed by commit rHGfaa243f345cc: rhg: Store p1, p2, and hash in RevlogEntry (authored by SimonSapin).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D11963?vs=31603&id=31615

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

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

AFFECTED FILES
  rust/hg-core/src/revlog/revlog.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/revlog/revlog.rs b/rust/hg-core/src/revlog/revlog.rs
--- a/rust/hg-core/src/revlog/revlog.rs
+++ b/rust/hg-core/src/revlog/revlog.rs
@@ -280,6 +280,9 @@
             } else {
                 Some(index_entry.base_revision_or_base_of_delta_chain())
             },
+            p1: index_entry.p1(),
+            p2: index_entry.p2(),
+            hash: *index_entry.hash(),
         };
         Ok(entry)
     }
@@ -304,6 +307,9 @@
     compressed_len: u32,
     uncompressed_len: i32,
     base_rev_or_base_of_delta_chain: Option<Revision>,
+    p1: Revision,
+    p2: Revision,
+    hash: Node,
 }
 
 impl<'a> RevlogEntry<'a> {
@@ -335,13 +341,6 @@
             entry = self.revlog.get_entry_internal(base_rev)?;
         }
 
-        // TODO do not look twice in the index
-        let index_entry = self
-            .revlog
-            .index
-            .get_entry(self.rev)
-            .ok_or_else(corrupted)?;
-
         let data = if delta_chain.is_empty() {
             entry.data_chunk()?
         } else {
@@ -349,9 +348,9 @@
         };
 
         if self.revlog.check_hash(
-            index_entry.p1(),
-            index_entry.p2(),
-            index_entry.hash().as_bytes(),
+            self.p1,
+            self.p2,
+            self.hash.as_bytes(),
             &data,
         ) {
             Ok(data)



To: SimonSapin, #hg-reviewers, Alphare
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20220107/9682e01d/attachment-0002.html>


More information about the Mercurial-patches mailing list