[Updated] D12545: rust-nodemap-docket: make unaware of `Repo`

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Tue Apr 19 21:42:16 UTC 2022


Closed by commit rHG704e993e8ee9: rust-nodemap-docket: make unaware of `Repo` (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D12545?vs=33183&id=33238

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

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

AFFECTED FILES
  rust/hg-core/src/revlog/nodemap_docket.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
@@ -118,7 +118,7 @@
             // If .hg/requires does not opt it, don’t try to open a nodemap
             None
         } else {
-            NodeMapDocket::read_from_file(repo, index_path)?.map(
+            NodeMapDocket::read_from_file(&repo.store_vfs(), index_path)?.map(
                 |(docket, data)| {
                     nodemap::NodeTree::load_bytes(
                         Box::new(data),
diff --git a/rust/hg-core/src/revlog/nodemap_docket.rs b/rust/hg-core/src/revlog/nodemap_docket.rs
--- a/rust/hg-core/src/revlog/nodemap_docket.rs
+++ b/rust/hg-core/src/revlog/nodemap_docket.rs
@@ -3,8 +3,8 @@
 use memmap2::Mmap;
 use std::path::{Path, PathBuf};
 
-use crate::repo::Repo;
 use crate::utils::strip_suffix;
+use crate::vfs::Vfs;
 
 const ONDISK_VERSION: u8 = 1;
 
@@ -34,12 +34,12 @@
     /// * The docket file points to a missing (likely deleted) data file (this
     ///   can happen in a rare race condition).
     pub fn read_from_file(
-        repo: &Repo,
+        store_vfs: &Vfs,
         index_path: &Path,
     ) -> Result<Option<(Self, Mmap)>, HgError> {
         let docket_path = index_path.with_extension("n");
         let docket_bytes = if let Some(bytes) =
-            repo.store_vfs().read(&docket_path).io_not_found_as_none()?
+            store_vfs.read(&docket_path).io_not_found_as_none()?
         {
             bytes
         } else {
@@ -75,10 +75,8 @@
         let data_path = rawdata_path(&docket_path, uid);
         // TODO: use `vfs.read()` here when the `persistent-nodemap.mmap`
         // config is false?
-        if let Some(mmap) = repo
-            .store_vfs()
-            .mmap_open(&data_path)
-            .io_not_found_as_none()?
+        if let Some(mmap) =
+            store_vfs.mmap_open(&data_path).io_not_found_as_none()?
         {
             if mmap.len() >= data_length {
                 Ok(Some((docket, mmap)))



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


More information about the Mercurial-patches mailing list