changeset 52763:37e9e6e1f470

rust: use methods for checked revisions There was some code that converted Revision to UncheckedRevision with .into() before calling a method. This change removes the .into() and calls the corresponding method for Revision instead.
author Mitchell Kember <mkember@janestreet.com>
date Thu, 16 Jan 2025 15:42:54 -0500
parents 169ccd142ef8
children 198674d830d6
files rust/hg-core/src/operations/cat.rs rust/hg-core/src/revlog/filelog.rs
diffstat 2 files changed, 2 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/rust/hg-core/src/operations/cat.rs	Thu Jan 16 15:36:26 2025 -0500
+++ b/rust/hg-core/src/operations/cat.rs	Thu Jan 16 15:42:54 2025 -0500
@@ -85,11 +85,8 @@
 ) -> Result<CatOutput<'a>, RevlogError> {
     let rev = crate::revset::resolve_single(revset, repo)?;
     let manifest = repo.manifest_for_rev(rev.into())?;
-    let node = *repo
-        .changelog()?
-        .node_from_unchecked_rev(rev.into())
-        .expect("should succeed when repo.manifest did");
     let mut results: Vec<(&'a HgPath, Vec<u8>)> = vec![];
+    let node = *repo.changelog()?.node_from_rev(rev);
     let mut found_any = false;
 
     files.sort_unstable();
--- a/rust/hg-core/src/revlog/filelog.rs	Thu Jan 16 15:36:26 2025 -0500
+++ b/rust/hg-core/src/revlog/filelog.rs	Thu Jan 16 15:42:54 2025 -0500
@@ -57,7 +57,7 @@
         file_node: impl Into<NodePrefix>,
     ) -> Result<FilelogRevisionData, RevlogError> {
         let file_rev = self.revlog.rev_from_node(file_node.into())?;
-        self.data_for_unchecked_rev(file_rev.into())
+        Ok(self.entry(file_rev)?.data()?)
     }
 
     /// The given revision is that of the file as found in a filelog, not of a