rust/hg-cpython/src/revlog.rs
changeset 51216 f6403bcd9f96
parent 51215 f0fa98752d67
child 51217 f95f70cf2ee2
--- a/rust/hg-cpython/src/revlog.rs	Wed Jun 28 11:59:43 2023 +0200
+++ b/rust/hg-cpython/src/revlog.rs	Wed Jun 28 16:43:39 2023 +0200
@@ -160,7 +160,16 @@
 
     def __delitem__(&self, key: PyObject) -> PyResult<()> {
         // __delitem__ is both for `del idx[r]` and `del idx[r1:r2]`
-        self.cindex(py).borrow().inner().del_item(py, key)?;
+        self.cindex(py).borrow().inner().del_item(py, &key)?;
+        let start = key.getattr(py, "start")?;
+        let start = UncheckedRevision(start.extract(py)?);
+        let start = self.index(py)
+            .borrow()
+            .check_revision(start)
+            .ok_or_else(|| {
+                nodemap_error(py, NodeMapError::RevisionNotInIndex(start))
+            })?;
+        self.index(py).borrow_mut().remove(start).unwrap();
         let mut opt = self.get_nodetree(py)?.borrow_mut();
         let nt = opt.as_mut().unwrap();
         nt.invalidate_all();