diff rust/hg-core/src/revlog/filelog.rs @ 50975:27e773aa607d

rust: implement the `Graph` trait for all revlogs This is trivial and makes all the algorithms relying on the trait usable for more use cases.
author Rapha?l Gom?s <rgomes@octobus.net>
date Thu, 10 Aug 2023 11:01:07 +0200
parents 1928b770e3e7
children 13f58ce70299
line wrap: on
line diff
--- a/rust/hg-core/src/revlog/filelog.rs	Thu Aug 10 11:00:34 2023 +0200
+++ b/rust/hg-core/src/revlog/filelog.rs	Thu Aug 10 11:01:07 2023 +0200
@@ -9,6 +9,8 @@
 use crate::utils::files::get_path_from_bytes;
 use crate::utils::hg_path::HgPath;
 use crate::utils::SliceExt;
+use crate::Graph;
+use crate::GraphError;
 use crate::UncheckedRevision;
 use std::path::PathBuf;
 
@@ -18,6 +20,12 @@
     revlog: Revlog,
 }
 
+impl Graph for Filelog {
+    fn parents(&self, rev: Revision) -> Result<[Revision; 2], GraphError> {
+        self.revlog.parents(rev)
+    }
+}
+
 impl Filelog {
     pub fn open_vfs(
         store_vfs: &crate::vfs::Vfs<'_>,