comparison rust/hg-cpython/src/revlog.rs @ 51245:0b81440e2a73

rust-index: using `hg::index::Index` in discovery At this point the C index is not used any more: we had to remove `pyindex_to_graph()` to avoid the dead code warning.
author Georges Racinet <georges.racinet@octobus.net>
date Sun, 29 Oct 2023 12:07:05 +0100
parents 7eea2e4109ae
children 41e19e8a6133
comparison
equal deleted inserted replaced
51244:03fdd4d7b5bd 51245:0b81440e2a73
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 }