##// END OF EJS Templates
rust-index: headrevsfiltered() returning Rust result
Georges Racinet -
r52110:898674a4 default
parent child Browse files
Show More
@@ -8,7 +8,6 b''
8 8 use crate::{
9 9 cindex,
10 10 conversion::rev_pyiter_collect,
11 exceptions::GraphError,
12 11 utils::{node_from_py_bytes, node_from_py_object},
13 12 PyRevision,
14 13 };
@@ -263,18 +262,9 b' py_class!(pub class MixedIndex |py| {'
263 262 def headrevsfiltered(&self, *args, **kw) -> PyResult<PyObject> {
264 263 let rust_res = self.inner_headrevsfiltered(py, &args.get_item(py, 0))?;
265 264 let c_res = self.call_cindex(py, "headrevsfiltered", args, kw)?;
266 assert_eq!(
267 rust_res.len(),
268 c_res.len(py)?,
269 "filtered heads differ {:?} {}",
270 rust_res,
271 c_res
272 );
273 for (index, rev) in rust_res.iter().enumerate() {
274 let c_rev: BaseRevision = c_res.get_item(py, index)?.extract(py)?;
275 assert_eq!(c_rev, rev.0);
276 }
277 Ok(c_res)
265
266 assert_py_eq(py, "headrevsfiltered", &rust_res, &c_res)?;
267 Ok(rust_res)
278 268 }
279 269
280 270 /// True if the object is a snapshot
@@ -817,13 +807,17 b' impl MixedIndex {'
817 807 &self,
818 808 py: Python,
819 809 filtered_revs: &PyObject,
820 ) -> PyResult<Vec<Revision>> {
810 ) -> PyResult<PyObject> {
821 811 let index = &mut *self.index(py).borrow_mut();
822 812 let filtered_revs = rev_pyiter_collect(py, filtered_revs, index)?;
823 813
824 index
814 let as_vec: Vec<PyObject> = index
825 815 .head_revs_filtered(&filtered_revs)
826 .map_err(|e| GraphError::pynew(py, e))
816 .map_err(|e| graph_error(py, e))?
817 .iter()
818 .map(|r| PyRevision::from(*r).into_py_object(py).into_object())
819 .collect();
820 Ok(PyList::new(py, &as_vec).into_object())
827 821 }
828 822 }
829 823
General Comments 0
You need to be logged in to leave comments. Login now