28 revlog::{nodemap::NodeMap, Graph, NodePrefix, RevlogError, RevlogIndex}, |
28 revlog::{nodemap::NodeMap, Graph, NodePrefix, RevlogError, RevlogIndex}, |
29 BaseRevision, Node, Revision, UncheckedRevision, NULL_REVISION, |
29 BaseRevision, Node, Revision, UncheckedRevision, NULL_REVISION, |
30 }; |
30 }; |
31 use std::{cell::RefCell, collections::HashMap}; |
31 use std::{cell::RefCell, collections::HashMap}; |
32 use vcsgraph::graph::Graph as VCSGraph; |
32 use vcsgraph::graph::Graph as VCSGraph; |
33 |
|
34 /// Return a Struct implementing the Graph trait |
|
35 pub(crate) fn pyindex_to_graph( |
|
36 py: Python, |
|
37 index: PyObject, |
|
38 ) -> PyResult<cindex::Index> { |
|
39 match index.extract::<MixedIndex>(py) { |
|
40 Ok(midx) => Ok(midx.clone_cindex(py)), |
|
41 Err(_) => cindex::Index::new(py, index), |
|
42 } |
|
43 } |
|
44 |
33 |
45 pub struct PySharedIndex { |
34 pub struct PySharedIndex { |
46 /// The underlying hg-core index |
35 /// The underlying hg-core index |
47 pub(crate) inner: &'static hg::index::Index, |
36 pub(crate) inner: &'static hg::index::Index, |
48 } |
37 } |