Mercurial > public > mercurial-scm > hg-stable
diff rust/hg-core/src/revlog/manifest.rs @ 52326:a3fa37bdb7ec
rust: normalize `_for_unchecked_rev` naming among revlogs and the index
This normalizes the naming scheme between the `Revlog`, `Changelog`, etc.
which is less suprising, though no real bugs could stem from this because of
the type signature mismatch.
The very high-level `Repo` object still uses an `UncheckedRevision` parameter
for its methods because that's what most callers will want.
author | Rapha?l Gom?s <rgomes@octobus.net> |
---|---|
date | Tue, 29 Oct 2024 11:00:04 +0100 |
parents | f4aede0f01af |
children | 94e2547e6f3d |
line wrap: on
line diff
--- a/rust/hg-core/src/revlog/manifest.rs Tue Nov 12 12:45:23 2024 +0100 +++ b/rust/hg-core/src/revlog/manifest.rs Tue Oct 29 11:00:04 2024 +0100 @@ -44,7 +44,7 @@ node: NodePrefix, ) -> Result<Manifest, RevlogError> { let rev = self.revlog.rev_from_node(node)?; - self.data_for_checked_rev(rev) + self.data(rev) } /// Return the `Manifest` of a given revision number. @@ -53,20 +53,17 @@ /// changeset. /// /// See also `Repo::manifest_for_rev` - pub fn data_for_rev( + pub fn data_for_unchecked_rev( &self, rev: UncheckedRevision, ) -> Result<Manifest, RevlogError> { - let bytes = self.revlog.get_rev_data(rev)?.into_owned(); + let bytes = self.revlog.get_data_for_unchecked_rev(rev)?.into_owned(); Ok(Manifest { bytes }) } - pub fn data_for_checked_rev( - &self, - rev: Revision, - ) -> Result<Manifest, RevlogError> { - let bytes = - self.revlog.get_rev_data_for_checked_rev(rev)?.into_owned(); + /// Same as [`Self::data_for_unchecked_rev`] for a checked [`Revision`] + pub fn data(&self, rev: Revision) -> Result<Manifest, RevlogError> { + let bytes = self.revlog.get_data(rev)?.into_owned(); Ok(Manifest { bytes }) } }