Mercurial > public > mercurial-scm > hg-stable
diff rust/hg-core/src/revlog/revlog.rs @ 48569:20d0d896183e
rhg: Rename some revlog-related types and methods
Use "data chunck" and "data" for a revlog entry?s data before and after
resolving deltas (if any), repsectively.
The former `FilelogEntry` actually only contains data, rename it to
`FilelogRevisionData` accordingly. This leaves room to later have a
`FilelogEntry` type that wraps `RevlogEntry`.
Differential Revision: https://phab.mercurial-scm.org/D11959
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Tue, 21 Dec 2021 15:57:30 +0100 |
parents | 96ea4db4741b |
children | f2f57724d4eb |
line wrap: on
line diff
--- a/rust/hg-core/src/revlog/revlog.rs Wed Jan 05 13:36:05 2022 -0500 +++ b/rust/hg-core/src/revlog/revlog.rs Tue Dec 21 15:57:30 2021 +0100 @@ -214,7 +214,7 @@ .ok_or(RevlogError::InvalidRevision)?; let data: Vec<u8> = if delta_chain.is_empty() { - entry.data()?.into() + entry.data_chunk()?.into() } else { Revlog::build_data_from_deltas(entry, &delta_chain)? }; @@ -260,11 +260,11 @@ snapshot: RevlogEntry, deltas: &[RevlogEntry], ) -> Result<Vec<u8>, RevlogError> { - let snapshot = snapshot.data()?; + let snapshot = snapshot.data_chunk()?; let deltas = deltas .iter() .rev() - .map(RevlogEntry::data) + .map(RevlogEntry::data_chunk) .collect::<Result<Vec<Cow<'_, [u8]>>, RevlogError>>()?; let patches: Vec<_> = deltas.iter().map(|d| patch::PatchList::new(d)).collect(); @@ -339,7 +339,8 @@ } /// Extract the data contained in the entry. - pub fn data(&self) -> Result<Cow<'_, [u8]>, RevlogError> { + /// This may be a delta. (See `is_delta`.) + fn data_chunk(&self) -> Result<Cow<'_, [u8]>, RevlogError> { if self.bytes.is_empty() { return Ok(Cow::Borrowed(&[])); }