Mercurial > hg-stable
changeset 50740:0159b014f3ab stable
rust-revlog: split out method for `rev_from_node` without persistent nodemap
This will make easier for the bug fix that is about to come.
author | Georges Racinet <georges.racinet@octobus.net> |
---|---|
date | Thu, 30 Mar 2023 10:29:29 +0200 |
parents | 48d9af6bd043 |
children | bca4037306da |
files | rust/hg-core/src/revlog/mod.rs |
diffstat | 1 files changed, 12 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/rust/hg-core/src/revlog/mod.rs Thu Jun 08 00:03:54 2023 -0400 +++ b/rust/hg-core/src/revlog/mod.rs Thu Mar 30 10:29:29 2023 +0200 @@ -234,11 +234,19 @@ .find_bin(&self.index, node)? .ok_or(RevlogError::InvalidRevision); } + self.rev_from_node_no_persistent_nodemap(node) + } - // Fallback to linear scan when a persistent nodemap is not present. - // This happens when the persistent-nodemap experimental feature is not - // enabled, or for small revlogs. - // + /// Same as `rev_from_node`, without using a persistent nodemap + /// + /// This is used as fallback when a persistent nodemap is not present. + /// This happens when the persistent-nodemap experimental feature is not + /// enabled, or for small revlogs. + fn rev_from_node_no_persistent_nodemap( + &self, + node: NodePrefix, + ) -> Result<Revision, RevlogError> { + // Linear scan of the revlog // TODO: consider building a non-persistent nodemap in memory to // optimize these cases. let mut found_by_prefix = None;