# HG changeset patch # User Georges Racinet # Date 2024-07-22 16:20:29 # 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 --git a/rust/hg-core/src/revlog/changelog.rs b/rust/hg-core/src/revlog/changelog.rs --- a/rust/hg-core/src/revlog/changelog.rs +++ b/rust/hg-core/src/revlog/changelog.rs @@ -8,6 +8,7 @@ use chrono::{DateTime, FixedOffset, Naiv 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 @@ impl Changelog { ) -> Result { self.revlog.rev_from_node(node) } + + pub fn get_index(&self) -> &Index { + &self.revlog.index + } } impl Graph for Changelog {