# HG changeset patch # User Raphaël Gomès # Date 1688031439 -7200 # Node ID f95f70cf2ee21383aa09c943e0da706e07c9d01c # Parent f6403bcd9f9603c1c65bdb142444e3d70a6b3bf1 rust-index: check rindex and cindex return the same get_rev This is a temporary safeguard while we synchronize both indexes. diff -r f6403bcd9f96 -r f95f70cf2ee2 rust/hg-cpython/src/revlog.rs --- 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