Patchwork D12562: repo: extract a function for checking nodemap requirement

login
register
mail settings
Submitter phabricator
Date April 15, 2022, 4:53 p.m.
Message ID <differential-rev-PHID-DREV-obxtuiehnprhk2ihvzo6-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50909/
State New
Headers show

Comments

phabricator - April 15, 2022, 4:53 p.m.
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/rust/hg-core/src/repo.rs b/rust/hg-core/src/repo.rs
--- a/rust/hg-core/src/repo.rs
+++ b/rust/hg-core/src/repo.rs
@@ -246,6 +246,11 @@ 
         self.requirements.contains(requirements::NARROW_REQUIREMENT)
     }
 
+    pub fn has_nodemap(&self) -> bool {
+        self.requirements
+            .contains(requirements::NODEMAP_REQUIREMENT)
+    }
+
     fn dirstate_file_contents(&self) -> Result<Vec<u8>, HgError> {
         Ok(self
             .hg_vfs()
@@ -345,10 +350,7 @@ 
     }
 
     fn new_changelog(&self) -> Result<Changelog, HgError> {
-        let use_nodemap = self
-            .requirements
-            .contains(requirements::NODEMAP_REQUIREMENT);
-        Changelog::open(&self.store_vfs(), use_nodemap)
+        Changelog::open(&self.store_vfs(), self.has_nodemap())
     }
 
     pub fn changelog(&self) -> Result<Ref<Changelog>, HgError> {
@@ -360,10 +362,7 @@ 
     }
 
     fn new_manifestlog(&self) -> Result<Manifestlog, HgError> {
-        let use_nodemap = self
-            .requirements
-            .contains(requirements::NODEMAP_REQUIREMENT);
-        Manifestlog::open(&self.store_vfs(), use_nodemap)
+        Manifestlog::open(&self.store_vfs(), self.has_nodemap())
     }
 
     pub fn manifestlog(&self) -> Result<Ref<Manifestlog>, HgError> {