D8154: rust-index: add `append` method to cindex/Index
gracinet (Georges Racinet)
phabricator at mercurial-scm.org
Wed Mar 11 15:42:23 UTC 2020
Closed by commit rHGcefd130c98be: rust-index: add `append` method to cindex/Index (authored by gracinet).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D8154?vs=20653&id=20692
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D8154/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D8154
AFFECTED FILES
rust/hg-cpython/src/cindex.rs
CHANGE DETAILS
diff --git a/rust/hg-cpython/src/cindex.rs b/rust/hg-cpython/src/cindex.rs
--- a/rust/hg-cpython/src/cindex.rs
+++ b/rust/hg-cpython/src/cindex.rs
@@ -10,7 +10,10 @@
//! Ideally, we should use an Index entirely implemented in Rust,
//! but this will take some time to get there.
-use cpython::{exc::ImportError, PyClone, PyErr, PyObject, PyResult, Python};
+use cpython::{
+ exc::ImportError, ObjectProtocol, PyClone, PyErr, PyObject, PyResult,
+ PyTuple, Python, PythonObject,
+};
use hg::revlog::{Node, RevlogIndex};
use hg::{Graph, GraphError, Revision, WORKING_DIRECTORY_REVISION};
use libc::c_int;
@@ -97,6 +100,15 @@
pub fn inner(&self) -> &PyObject {
&self.index
}
+
+ pub fn append(&mut self, py: Python, tup: PyTuple) -> PyResult<PyObject> {
+ self.index.call_method(
+ py,
+ "append",
+ PyTuple::new(py, &[tup.into_object()]),
+ None,
+ )
+ }
}
impl Clone for Index {
To: Alphare, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list