Mercurial > public > mercurial-scm > hg-stable
diff rust/hg-core/src/revlog/inner_revlog.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 | 8d35941689af |
children | f90796d33aa0 |
line wrap: on
line diff
--- a/rust/hg-core/src/revlog/inner_revlog.rs Tue Nov 12 12:45:23 2024 +0100 +++ b/rust/hg-core/src/revlog/inner_revlog.rs Tue Oct 29 11:00:04 2024 +0100 @@ -160,7 +160,7 @@ } /// Return the [`RevlogEntry`] for a [`Revision`] that is known to exist - pub fn get_entry_for_checked_rev( + pub fn get_entry( &self, rev: Revision, ) -> Result<RevlogEntry, RevlogError> { @@ -199,10 +199,7 @@ /// Return the [`RevlogEntry`] for `rev`. If `rev` fails to check, this /// returns a [`RevlogError`]. - /// TODO normalize naming across the index and all revlogs - /// (changelog, etc.) so that `get_entry` is always on an unchecked rev and - /// `get_entry_for_checked_rev` is for checked rev - pub fn get_entry( + pub fn get_entry_for_unchecked_rev( &self, rev: UncheckedRevision, ) -> Result<RevlogEntry, RevlogError> { @@ -212,7 +209,7 @@ let rev = self.index.check_revision(rev).ok_or_else(|| { RevlogError::corrupted(format!("rev {} is invalid", rev)) })?; - self.get_entry_for_checked_rev(rev) + self.get_entry(rev) } /// Is the revlog currently delaying the visibility of written data? @@ -471,7 +468,7 @@ ) -> Result<(), RevlogError>, ) -> Result<(), RevlogError>, { - let entry = &self.get_entry_for_checked_rev(rev)?; + let entry = &self.get_entry(rev)?; let raw_size = entry.uncompressed_len(); let mut mutex_guard = self .last_revision_cache