diff rust/hg-core/src/revlog/manifest.rs @ 50989: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/manifest.rs	Thu Aug 10 11:00:34 2023 +0200
+++ b/rust/hg-core/src/revlog/manifest.rs	Thu Aug 10 11:01:07 2023 +0200
@@ -4,7 +4,7 @@
 use crate::utils::hg_path::HgPath;
 use crate::utils::SliceExt;
 use crate::vfs::Vfs;
-use crate::{Revision, UncheckedRevision};
+use crate::{Graph, GraphError, Revision, UncheckedRevision};
 
 /// A specialized `Revlog` to work with `manifest` data format.
 pub struct Manifestlog {
@@ -12,6 +12,12 @@
     revlog: Revlog,
 }
 
+impl Graph for Manifestlog {
+    fn parents(&self, rev: Revision) -> Result<[Revision; 2], GraphError> {
+        self.revlog.parents(rev)
+    }
+}
+
 impl Manifestlog {
     /// Open the `manifest` of a repository given by its root.
     pub fn open(store_vfs: &Vfs, use_nodemap: bool) -> Result<Self, HgError> {