# HG changeset patch # User Georges Racinet # Date 2020-02-12 09:53:24 # Node ID cadcc8c208603ec1df343497a64b48b502eea830 # Parent 15febf99a9c637eb15b55cc6036631629be3af6c rust-nodemap: also clear Rust data in `clearcaches` Differential Revision: https://phab.mercurial-scm.org/D8161 diff --git a/rust/hg-cpython/src/revlog.rs b/rust/hg-cpython/src/revlog.rs --- a/rust/hg-cpython/src/revlog.rs +++ b/rust/hg-cpython/src/revlog.rs @@ -161,8 +161,12 @@ py_class!(pub class MixedIndex |py| { self.call_cindex(py, "commonancestorsheads", args, kw) } - /// clear the index caches + /// Clear the index caches and inner py_class data. + /// It is Python's responsibility to call `update_nodemap_data` again. def clearcaches(&self, *args, **kw) -> PyResult { + self.nt(py).borrow_mut().take(); + self.docket(py).borrow_mut().take(); + self.mmap(py).borrow_mut().take(); self.call_cindex(py, "clearcaches", args, kw) } @@ -231,7 +235,7 @@ py_class!(pub class MixedIndex |py| { // `index_getitem` does not handle conversion from PyLong, // which expressions such as [e for e in index] internally use. // Note that we don't seem to have a direct way to call - // PySequence_GetItem (does the job), which would be better for + // PySequence_GetItem (does the job), which would possibly be better // for performance let key = match key.extract::(py) { Ok(rev) => rev.to_py_object(py).into_object(),