Show More
@@ -1,4 +1,5 b'' | |||||
1 | use crate::errors::{HgError, HgResultExt}; |
|
1 | use crate::errors::{HgError, HgResultExt}; | |
|
2 | use crate::requirements; | |||
2 | use bytes_cast::{unaligned, BytesCast}; |
|
3 | use bytes_cast::{unaligned, BytesCast}; | |
3 | use memmap::Mmap; |
|
4 | use memmap::Mmap; | |
4 | use std::path::{Path, PathBuf}; |
|
5 | use std::path::{Path, PathBuf}; | |
@@ -38,6 +39,14 b' impl NodeMapDocket {' | |||||
38 | repo: &Repo, |
|
39 | repo: &Repo, | |
39 | index_path: &Path, |
|
40 | index_path: &Path, | |
40 | ) -> Result<Option<(Self, Mmap)>, RevlogError> { |
|
41 | ) -> Result<Option<(Self, Mmap)>, RevlogError> { | |
|
42 | if !repo | |||
|
43 | .requirements() | |||
|
44 | .contains(requirements::NODEMAP_REQUIREMENT) | |||
|
45 | { | |||
|
46 | // If .hg/requires does not opt it, don’t try to open a nodemap | |||
|
47 | return Ok(None); | |||
|
48 | } | |||
|
49 | ||||
41 | let docket_path = index_path.with_extension("n"); |
|
50 | let docket_path = index_path.with_extension("n"); | |
42 | let docket_bytes = if let Some(bytes) = |
|
51 | let docket_bytes = if let Some(bytes) = | |
43 | repo.store_vfs().read(&docket_path).io_not_found_as_none()? |
|
52 | repo.store_vfs().read(&docket_path).io_not_found_as_none()? | |
@@ -88,6 +97,8 b' impl NodeMapDocket {' | |||||
88 | Err(HgError::corrupted("persistent nodemap too short").into()) |
|
97 | Err(HgError::corrupted("persistent nodemap too short").into()) | |
89 | } |
|
98 | } | |
90 | } else { |
|
99 | } else { | |
|
100 | // Even if .hg/requires opted in, some revlogs are deemed small | |||
|
101 | // enough to not need a persistent nodemap. | |||
91 | Ok(None) |
|
102 | Ok(None) | |
92 | } |
|
103 | } | |
93 | } |
|
104 | } |
General Comments 0
You need to be logged in to leave comments.
Login now