diff --git a/rust/hg-core/src/ancestors.rs b/rust/hg-core/src/ancestors.rs --- a/rust/hg-core/src/ancestors.rs +++ b/rust/hg-core/src/ancestors.rs @@ -423,6 +423,18 @@ mod tests { ), vec![8, 7, 4, 3, 2, 1, 0] ); + // it works as well on references, because &Graph implements Graph + // this is needed as of this writing by RHGitaly + assert_eq!( + list_ancestors( + &SampleGraph, + vec![11.into(), 13.into()], + 0.into(), + false + ), + vec![8, 7, 4, 3, 2, 1, 0] + ); + assert_eq!( list_ancestors( SampleGraph, diff --git a/rust/hg-core/src/revlog/mod.rs b/rust/hg-core/src/revlog/mod.rs --- a/rust/hg-core/src/revlog/mod.rs +++ b/rust/hg-core/src/revlog/mod.rs @@ -132,6 +132,12 @@ pub enum GraphError { ParentOutOfRange(Revision), } +impl Graph for &T { + fn parents(&self, rev: Revision) -> Result<[Revision; 2], GraphError> { + (*self).parents(rev) + } +} + /// The Mercurial Revlog Index /// /// This is currently limited to the minimal interface that is needed for