diff --git a/rust/hg-cpython/src/cindex.rs b/rust/hg-cpython/src/cindex.rs index 99a0b5422cf55c612b9fca9951773ec8d2c42865_cnVzdC9oZy1jcHl0aG9uL3NyYy9jaW5kZXgucnM=..8e8737a1fa7d63e77a23767ed33c2116e1f9dd2d_cnVzdC9oZy1jcHl0aG9uL3NyYy9jaW5kZXgucnM= 100644 --- a/rust/hg-cpython/src/cindex.rs +++ b/rust/hg-cpython/src/cindex.rs @@ -155,6 +155,24 @@ } } +impl vcsgraph::graph::Graph for Index { + fn parents( + &self, + rev: Revision, + ) -> Result<vcsgraph::graph::Parents, vcsgraph::graph::GraphReadError> + { + match Graph::parents(self, rev) { + Ok(parents) => Ok(vcsgraph::graph::Parents(parents)), + Err(GraphError::ParentOutOfRange(rev)) => { + Err(vcsgraph::graph::GraphReadError::KeyedInvalidKey(rev)) + } + Err(GraphError::WorkingDirectoryUnsupported) => Err( + vcsgraph::graph::GraphReadError::WorkingDirectoryUnsupported, + ), + } + } +} + impl RevlogIndex for Index { /// Note C return type is Py_ssize_t (hence signed), but we shall /// force it to unsigned, because it's a length