rust/hg-cpython/src/revlog.rs
changeset 44010 2728fcb8127c
parent 43961 b69d5f3a41d0
child 44011 c627f1b2f3c3
--- a/rust/hg-cpython/src/revlog.rs	Fri Dec 06 20:40:02 2019 -0500
+++ b/rust/hg-cpython/src/revlog.rs	Fri Dec 13 19:52:26 2019 +0100
@@ -7,17 +7,14 @@
 
 use crate::cindex;
 use cpython::{
-    ObjectProtocol, PyDict, PyModule, PyObject, PyResult, PyTuple, Python,
-    PythonObject, ToPyObject,
+    ObjectProtocol, PyClone, PyDict, PyModule, PyObject, PyResult, PyTuple, Python, PythonObject,
+    ToPyObject,
 };
 use hg::Revision;
 use std::cell::RefCell;
 
 /// 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> {
     cindex::Index::new(py, index)
 }
 
@@ -198,6 +195,10 @@
             .inner()
             .call_method(py, name, args, kwargs)
     }
+
+    pub fn clone_cindex(&self, py: Python) -> cindex::Index {
+        self.cindex(py).borrow().clone_ref(py)
+    }
 }
 
 /// Create the module, with __package__ given from parent