[Updated] D11659: rhg: do not try to open a nodemap for an inline index

aalekseyev (Arseniy Alekseyev) phabricator at mercurial-scm.org
Thu Oct 14 22:36:03 UTC 2021


Closed by commit rHG5e77bdc29d56: rhg: do not try to open a nodemap for an inline index (authored by aalekseyev).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D11659?vs=30802&id=30813

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

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

AFFECTED FILES
  rust/hg-core/src/revlog/index.rs
  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
@@ -99,14 +99,18 @@
                 Some(Box::new(data_mmap))
             };
 
-        let nodemap = NodeMapDocket::read_from_file(repo, index_path)?.map(
-            |(docket, data)| {
-                nodemap::NodeTree::load_bytes(
-                    Box::new(data),
-                    docket.data_length,
-                )
-            },
-        );
+        let nodemap = if index.is_inline() {
+            None
+        } else {
+            NodeMapDocket::read_from_file(repo, index_path)?.map(
+                |(docket, data)| {
+                    nodemap::NodeTree::load_bytes(
+                        Box::new(data),
+                        docket.data_length,
+                    )
+                },
+            )
+        };
 
         Ok(Revlog {
             index,
diff --git a/rust/hg-core/src/revlog/index.rs b/rust/hg-core/src/revlog/index.rs
--- a/rust/hg-core/src/revlog/index.rs
+++ b/rust/hg-core/src/revlog/index.rs
@@ -57,7 +57,7 @@
 
     /// Value of the inline flag.
     pub fn is_inline(&self) -> bool {
-        is_inline(&self.bytes)
+        self.offsets.is_some()
     }
 
     /// Return a slice of bytes if `revlog` is inline. Panic if not.



To: aalekseyev, #hg-reviewers, pulkit
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20211014/85714669/attachment-0002.html>


More information about the Mercurial-patches mailing list