##// END OF EJS Templates
rust-nodemap-docket: move check of nodemap requirement to caller...
Martin von Zweigbergk -
r49976:07d8d144 default
parent child Browse files
Show More
@@ -1,5 +1,4 b''
1 use crate::errors::{HgError, HgResultExt};
1 use crate::errors::{HgError, HgResultExt};
2 use crate::requirements;
3 use bytes_cast::{unaligned, BytesCast};
2 use bytes_cast::{unaligned, BytesCast};
4 use memmap2::Mmap;
3 use memmap2::Mmap;
5 use std::path::{Path, PathBuf};
4 use std::path::{Path, PathBuf};
@@ -38,14 +37,6 b' impl NodeMapDocket {'
38 repo: &Repo,
37 repo: &Repo,
39 index_path: &Path,
38 index_path: &Path,
40 ) -> Result<Option<(Self, Mmap)>, HgError> {
39 ) -> Result<Option<(Self, Mmap)>, HgError> {
41 if !repo
42 .requirements()
43 .contains(requirements::NODEMAP_REQUIREMENT)
44 {
45 // If .hg/requires does not opt it, don’t try to open a nodemap
46 return Ok(None);
47 }
48
49 let docket_path = index_path.with_extension("n");
40 let docket_path = index_path.with_extension("n");
50 let docket_bytes = if let Some(bytes) =
41 let docket_bytes = if let Some(bytes) =
51 repo.store_vfs().read(&docket_path).io_not_found_as_none()?
42 repo.store_vfs().read(&docket_path).io_not_found_as_none()?
@@ -18,7 +18,7 b' use super::patch;'
18 use crate::errors::HgError;
18 use crate::errors::HgError;
19 use crate::repo::Repo;
19 use crate::repo::Repo;
20 use crate::revlog::Revision;
20 use crate::revlog::Revision;
21 use crate::{Node, NULL_REVISION};
21 use crate::{requirements, Node, NULL_REVISION};
22
22
23 const REVISION_FLAG_CENSORED: u16 = 1 << 15;
23 const REVISION_FLAG_CENSORED: u16 = 1 << 15;
24 const REVISION_FLAG_ELLIPSIS: u16 = 1 << 14;
24 const REVISION_FLAG_ELLIPSIS: u16 = 1 << 14;
@@ -111,6 +111,12 b' impl Revlog {'
111
111
112 let nodemap = if index.is_inline() {
112 let nodemap = if index.is_inline() {
113 None
113 None
114 } else if !repo
115 .requirements()
116 .contains(requirements::NODEMAP_REQUIREMENT)
117 {
118 // If .hg/requires does not opt it, don’t try to open a nodemap
119 None
114 } else {
120 } else {
115 NodeMapDocket::read_from_file(repo, index_path)?.map(
121 NodeMapDocket::read_from_file(repo, index_path)?.map(
116 |(docket, data)| {
122 |(docket, data)| {
General Comments 0
You need to be logged in to leave comments. Login now