Details
Details
- Reviewers
pulkit - Group Reviewers
hg-reviewers
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Branch
- default
- Lint
No Linters Available - Unit
No Unit Test Coverage
pulkit |
hg-reviewers |
No Linters Available |
No Unit Test Coverage |
Path | Packages | |||
---|---|---|---|---|
M | rust/hg-cpython/src/revlog.rs (9 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
f9a273190f1e | 0d529ab52776 | Raphaël Gomès | Jan 14 2020, 12:04 PM |
// revlog.rs | // revlog.rs | ||||
// | // | ||||
// Copyright 2019 Georges Racinet <georges.racinet@octobus.net> | // Copyright 2019 Georges Racinet <georges.racinet@octobus.net> | ||||
// | // | ||||
// This software may be used and distributed according to the terms of the | // This software may be used and distributed according to the terms of the | ||||
// GNU General Public License version 2 or any later version. | // GNU General Public License version 2 or any later version. | ||||
use crate::cindex; | use crate::cindex; | ||||
use cpython::{ | use cpython::{ | ||||
ObjectProtocol, PyClone, PyDict, PyModule, PyObject, PyResult, PyTuple, Python, PythonObject, | ObjectProtocol, PyClone, PyDict, PyModule, PyObject, PyResult, PyTuple, | ||||
ToPyObject, | Python, PythonObject, ToPyObject, | ||||
}; | }; | ||||
use hg::Revision; | use hg::Revision; | ||||
use std::cell::RefCell; | use std::cell::RefCell; | ||||
/// Return a Struct implementing the Graph trait | /// Return a Struct implementing the Graph trait | ||||
pub(crate) fn pyindex_to_graph(py: Python, index: PyObject) -> PyResult<cindex::Index> { | pub(crate) fn pyindex_to_graph( | ||||
py: Python, | |||||
index: PyObject, | |||||
) -> PyResult<cindex::Index> { | |||||
match index.extract::<MixedIndex>(py) { | match index.extract::<MixedIndex>(py) { | ||||
Ok(midx) => Ok(midx.clone_cindex(py)), | Ok(midx) => Ok(midx.clone_cindex(py)), | ||||
Err(_) => cindex::Index::new(py, index), | Err(_) => cindex::Index::new(py, index), | ||||
} | } | ||||
} | } | ||||
py_class!(pub class MixedIndex |py| { | py_class!(pub class MixedIndex |py| { | ||||
data cindex: RefCell<cindex::Index>; | data cindex: RefCell<cindex::Index>; |