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.
--- 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 {