rust/hg-cpython/src/revlog.rs
changeset 51245 0b81440e2a73
parent 51239 7eea2e4109ae
child 51246 41e19e8a6133
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 }