Mercurial > hg
changeset 44511:cadcc8c20860
rust-nodemap: also clear Rust data in `clearcaches`
Differential Revision: https://phab.mercurial-scm.org/D8161
author | Georges Racinet <georges.racinet@octobus.net> |
---|---|
date | Wed, 12 Feb 2020 10:53:24 +0100 |
parents | 15febf99a9c6 |
children | febe88a6f7f7 |
files | rust/hg-cpython/src/revlog.rs |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/rust/hg-cpython/src/revlog.rs Wed Feb 12 10:53:19 2020 +0100 +++ b/rust/hg-cpython/src/revlog.rs Wed Feb 12 10:53:24 2020 +0100 @@ -161,8 +161,12 @@ 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<PyObject> { + 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 @@ // `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::<Revision>(py) { Ok(rev) => rev.to_py_object(py).into_object(),