comparison rust/hg-cpython/src/revlog.rs @ 44011:c627f1b2f3c3

rust-index: handle `MixedIndex` in `pyindex_to_graph` On the long run we will want to implement the Graph trait directly in Rust, but for now we take the path with the least amount of change to focus on the coming persistent NodeMap code. We test this new code through with the lazy ancestors code. Differential Revision: https://phab.mercurial-scm.org/D7657
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 12 Dec 2019 18:11:44 +0100
parents 2728fcb8127c
children 443dc1655923
comparison
equal deleted inserted replaced
44010:2728fcb8127c 44011:c627f1b2f3c3
13 use hg::Revision; 13 use hg::Revision;
14 use std::cell::RefCell; 14 use std::cell::RefCell;
15 15
16 /// Return a Struct implementing the Graph trait 16 /// Return a Struct implementing the Graph trait
17 pub(crate) fn pyindex_to_graph(py: Python, index: PyObject) -> PyResult<cindex::Index> { 17 pub(crate) fn pyindex_to_graph(py: Python, index: PyObject) -> PyResult<cindex::Index> {
18 cindex::Index::new(py, index) 18 match index.extract::<MixedIndex>(py) {
19 Ok(midx) => Ok(midx.clone_cindex(py)),
20 Err(_) => cindex::Index::new(py, index),
21 }
19 } 22 }
20 23
21 py_class!(pub class MixedIndex |py| { 24 py_class!(pub class MixedIndex |py| {
22 data cindex: RefCell<cindex::Index>; 25 data cindex: RefCell<cindex::Index>;
23 26