Mercurial > hg-stable
changeset 49146:9b5334c1e499
rust-repo: extract a function for checking nodemap requirement
Differential Revision: https://phab.mercurial-scm.org/D12562
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 15 Apr 2022 09:39:27 -0700 |
parents | a5ef50becea8 |
children | d200ecb76c72 |
files | rust/hg-core/src/repo.rs |
diffstat | 1 files changed, 7 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/rust/hg-core/src/repo.rs Fri Apr 15 09:37:13 2022 -0700 +++ b/rust/hg-core/src/repo.rs Fri Apr 15 09:39:27 2022 -0700 @@ -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> {