rust-changelog: accessing the index
authorGeorges Racinet <georges.racinet@cloudcrane.io>
Mon, 22 Jul 2024 18:20:29 +0200
changeset 51725 bbe59cc5d2e1
parent 51724 a3dc962cac62
child 51726 587153c96fe3
rust-changelog: accessing the index The `Index` object is currently the one providing all DAG related algorithms, starting with simple ancestors iteration up to more advanced ones (ranges, common ancestors…). From pure Rust code, there was no way to access the changelog index for a given `Repository`, probably because `rhg` does not use any such algorithm yet.
rust/hg-core/src/revlog/changelog.rs
--- a/rust/hg-core/src/revlog/changelog.rs	Sat Jul 20 17:03:30 2024 -0400
+++ b/rust/hg-core/src/revlog/changelog.rs	Mon Jul 22 18:20:29 2024 +0200
@@ -8,6 +8,7 @@
 use itertools::{Either, Itertools};
 
 use crate::errors::HgError;
+use crate::revlog::Index;
 use crate::revlog::Revision;
 use crate::revlog::{Node, NodePrefix};
 use crate::revlog::{Revlog, RevlogEntry, RevlogError};
@@ -81,6 +82,10 @@
     ) -> Result<Revision, RevlogError> {
         self.revlog.rev_from_node(node)
     }
+
+    pub fn get_index(&self) -> &Index {
+        &self.revlog.index
+    }
 }
 
 impl Graph for Changelog {