# HG changeset patch # User Georges Racinet # Date 1721665229 -7200 # Node ID bbe59cc5d2e1cdec7550716a6b6a3d1b2c71ced3 # Parent a3dc962cac6224939f6aedb3050e88d593e6085f 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. diff -r a3dc962cac62 -r bbe59cc5d2e1 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 { self.revlog.rev_from_node(node) } + + pub fn get_index(&self) -> &Index { + &self.revlog.index + } } impl Graph for Changelog {