rust/hg-cpython/src/dagops.rs
changeset 43945 f98f0e3ddaa1
parent 43269 33fe96a5c522
child 48854 8b8054b8e5a7
--- a/rust/hg-cpython/src/dagops.rs	Wed Dec 11 18:40:04 2019 +0100
+++ b/rust/hg-cpython/src/dagops.rs	Fri Dec 13 19:59:59 2019 +0100
@@ -9,14 +9,14 @@
 //! `hg-core` package.
 //!
 //! From Python, this will be seen as `mercurial.rustext.dagop`
-use crate::{
-    cindex::Index, conversion::rev_pyiter_collect, exceptions::GraphError,
-};
+use crate::{conversion::rev_pyiter_collect, exceptions::GraphError};
 use cpython::{PyDict, PyModule, PyObject, PyResult, Python};
 use hg::dagops;
 use hg::Revision;
 use std::collections::HashSet;
 
+use crate::revlog::pyindex_to_graph;
+
 /// Using the the `index`, return heads out of any Python iterable of Revisions
 ///
 /// This is the Rust counterpart for `mercurial.dagop.headrevs`
@@ -26,7 +26,7 @@
     revs: PyObject,
 ) -> PyResult<HashSet<Revision>> {
     let mut as_set: HashSet<Revision> = rev_pyiter_collect(py, &revs)?;
-    dagops::retain_heads(&Index::new(py, index)?, &mut as_set)
+    dagops::retain_heads(&pyindex_to_graph(py, index)?, &mut as_set)
         .map_err(|e| GraphError::pynew(py, e))?;
     Ok(as_set)
 }