changeset 51196:f95f70cf2ee2

rust-index: check rindex and cindex return the same get_rev This is a temporary safeguard while we synchronize both indexes.
author Raphaël Gomès <rgomes@octobus.net>
date Thu, 29 Jun 2023 11:37:19 +0200
parents f6403bcd9f96
children 4e6620b7fbbb
files rust/hg-cpython/src/revlog.rs
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/rust/hg-cpython/src/revlog.rs	Wed Jun 28 16:43:39 2023 +0200
+++ b/rust/hg-cpython/src/revlog.rs	Thu Jun 29 11:37:19 2023 +0200
@@ -74,9 +74,15 @@
         let opt = self.get_nodetree(py)?.borrow();
         let nt = opt.as_ref().unwrap();
         let idx = &*self.cindex(py).borrow();
+        let ridx = &*self.index(py).borrow();
         let node = node_from_py_bytes(py, &node)?;
-        let res = nt.find_bin(idx, node.into());
-        Ok(res.map_err(|e| nodemap_error(py, e))?.map(Into::into))
+        let rust_rev =
+            nt.find_bin(ridx, node.into()).map_err(|e| nodemap_error(py, e))?;
+        let c_rev =
+            nt.find_bin(idx, node.into()).map_err(|e| nodemap_error(py, e))?;
+        assert_eq!(rust_rev, c_rev);
+        Ok(rust_rev.map(Into::into))
+
     }
 
     /// same as `get_rev()` but raises a bare `error.RevlogError` if node