diff rust/hg-cpython/src/discovery.rs @ 42736:b6f3f704a561

rust-discovery: read the index from a repo passed at init This makes the API of the Rust PartialDiscovery object now the same (or rather a subset) of the Python object, hence easier to control through module policy down the road. Differential Revision: https://phab.mercurial-scm.org/D6517
author Georges Racinet <georges.racinet@octobus.net>
date Wed, 12 Jun 2019 14:31:41 +0100
parents 5154701a5413
children 8041a1b45163
line wrap: on
line diff
--- a/rust/hg-cpython/src/discovery.rs	Wed Jun 12 14:18:12 2019 +0100
+++ b/rust/hg-cpython/src/discovery.rs	Wed Jun 12 14:31:41 2019 +0100
@@ -34,10 +34,11 @@
     // implemented.
     def __new__(
         _cls,
-        index: PyObject,
+        repo: PyObject,
         targetheads: PyObject,
         _respectsize: bool
     ) -> PyResult<PartialDiscovery> {
+        let index = repo.getattr(py, "changelog")?.getattr(py, "index")?;
         Self::create_instance(
             py,
             RefCell::new(Box::new(CorePartialDiscovery::new(