diff rust/hg-core/src/revlog/manifest.rs @ 49145:a5ef50becea8

rust-revlog: make `Changelog` and `ManifestLog` unaware of `Repo` As with other recent patches, this makes the types easier to test and reuse. Differential Revision: https://phab.mercurial-scm.org/D12561
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 15 Apr 2022 09:37:13 -0700
parents 399439c12223
children 750409505286
line wrap: on
line diff
--- a/rust/hg-core/src/revlog/manifest.rs	Tue Apr 12 21:25:56 2022 -0700
+++ b/rust/hg-core/src/revlog/manifest.rs	Fri Apr 15 09:37:13 2022 -0700
@@ -1,11 +1,10 @@
 use crate::errors::HgError;
-use crate::repo::Repo;
-use crate::requirements;
 use crate::revlog::revlog::{Revlog, RevlogError};
 use crate::revlog::Revision;
 use crate::revlog::{Node, NodePrefix};
 use crate::utils::hg_path::HgPath;
 use crate::utils::SliceExt;
+use crate::vfs::Vfs;
 
 /// A specialized `Revlog` to work with `manifest` data format.
 pub struct Manifestlog {
@@ -15,16 +14,9 @@
 
 impl Manifestlog {
     /// Open the `manifest` of a repository given by its root.
-    pub fn open(repo: &Repo) -> Result<Self, HgError> {
-        let use_nodemap = repo
-            .requirements()
-            .contains(requirements::NODEMAP_REQUIREMENT);
-        let revlog = Revlog::open(
-            &repo.store_vfs(),
-            "00manifest.i",
-            None,
-            use_nodemap,
-        )?;
+    pub fn open(store_vfs: &Vfs, use_nodemap: bool) -> Result<Self, HgError> {
+        let revlog =
+            Revlog::open(store_vfs, "00manifest.i", None, use_nodemap)?;
         Ok(Self { revlog })
     }