Mercurial > public > mercurial-scm > hg
diff rust/hg-core/src/revlog/revlog.rs @ 49085:07d8d144c222
rust-nodemap-docket: move check of nodemap requirement to caller
I think it's cleaner if `NodeMapDocket` doesn't know about the `Repo`
type. That makes it more easily reusable and testable. This patch
moves out one of the uses of `Repo` out of it.
Differential Revision: https://phab.mercurial-scm.org/D12544
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 31 Mar 2022 22:59:19 -0700 |
parents | 5d205e476057 |
children | 704e993e8ee9 |
line wrap: on
line diff
--- a/rust/hg-core/src/revlog/revlog.rs Tue Apr 19 10:53:58 2022 -0400 +++ b/rust/hg-core/src/revlog/revlog.rs Thu Mar 31 22:59:19 2022 -0700 @@ -18,7 +18,7 @@ use crate::errors::HgError; use crate::repo::Repo; use crate::revlog::Revision; -use crate::{Node, NULL_REVISION}; +use crate::{requirements, Node, NULL_REVISION}; const REVISION_FLAG_CENSORED: u16 = 1 << 15; const REVISION_FLAG_ELLIPSIS: u16 = 1 << 14; @@ -111,6 +111,12 @@ let nodemap = if index.is_inline() { None + } else if !repo + .requirements() + .contains(requirements::NODEMAP_REQUIREMENT) + { + // If .hg/requires does not opt it, don’t try to open a nodemap + None } else { NodeMapDocket::read_from_file(repo, index_path)?.map( |(docket, data)| {