diff rust/hg-cpython/src/copy_tracing.rs @ 46569:34827c95092c

copies-rust: remove the ancestor Oracle logic We are not doing any `is_ancestor` call anymore. So we can drop that logic and associated arguments. Differential Revision: https://phab.mercurial-scm.org/D9645
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 15 Dec 2020 18:22:57 +0100
parents 294d5aca4ff5
children cb4b0b0c6de4
line wrap: on
line diff
--- a/rust/hg-cpython/src/copy_tracing.rs	Tue Dec 15 18:04:23 2020 +0100
+++ b/rust/hg-cpython/src/copy_tracing.rs	Tue Dec 15 18:22:57 2020 +0100
@@ -1,5 +1,4 @@
 use cpython::ObjectProtocol;
-use cpython::PyBool;
 use cpython::PyBytes;
 use cpython::PyDict;
 use cpython::PyList;
@@ -26,32 +25,10 @@
     children_count: PyDict,
     target_rev: Revision,
     rev_info: PyObject,
-    is_ancestor: PyObject,
 ) -> PyResult<PyDict> {
     let revs: PyResult<_> =
         revs.iter(py).map(|r| Ok(r.extract(py)?)).collect();
 
-    // Wrap the `is_ancestor` python callback as a Rust closure
-    //
-    // No errors are expected from the Python side, and they will should only
-    // happens in case of programing error or severe data corruption. Such
-    // errors will raise panic and the rust-cpython harness will turn them into
-    // Python exception.
-    let is_ancestor_wrap = |anc: Revision, desc: Revision| -> bool {
-        is_ancestor
-            .call(py, (anc, desc), None)
-            .expect(
-                "rust-copy-tracing: python call  to `is_ancestor` \
-                failed",
-            )
-            .cast_into::<PyBool>(py)
-            .expect(
-                "rust-copy-tracing: python call  to `is_ancestor` \
-                returned unexpected non-Bool value",
-            )
-            .is_true()
-    };
-
     // Wrap the `rev_info_maker` python callback as a Rust closure
     //
     // No errors are expected from the Python side, and they will should only
@@ -104,7 +81,6 @@
         children_count?,
         target_rev,
         rev_info_maker,
-        &is_ancestor_wrap,
     );
     let out = PyDict::new(py);
     for (dest, source) in res.into_iter() {
@@ -134,8 +110,7 @@
                 revs: PyList,
                 children: PyDict,
                 target_rev: Revision,
-                rev_info: PyObject,
-                is_ancestor: PyObject
+                rev_info: PyObject
             )
         ),
     )?;