changeset 51725:bbe59cc5d2e1

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.
author Georges Racinet <georges.racinet@cloudcrane.io>
date Mon, 22 Jul 2024 18:20:29 +0200
parents a3dc962cac62
children 587153c96fe3
files rust/hg-core/src/revlog/changelog.rs
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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 {