Mercurial > public > mercurial-scm > hg-stable
diff rust/hg-pyo3/src/exceptions.rs @ 52808:adf91dfe6c04
rust-pyo3-index: _index_headrevs
This one demonstrates that why the `with_index_read` and similar
helpers are useful and was actually the main motivation for doing
them: if we kept the borrow used to grab the index before updating
the caches, there would be a panic when calling `borrow_mut`.
This was confirmed with an earlier version by the Python test.
There are perhaps some internal API clarifications to be made, as
the method updating the cache does a seemingly useless return), but
we are keeping it as it was in `hg-cpython`.
author | Georges Racinet <georges.racinet@cloudcrane.io> |
---|---|
date | Wed, 25 Dec 2024 19:06:59 +0100 |
parents | acae91fad6be |
children | ffda57aa98fa |
line wrap: on
line diff
--- a/rust/hg-pyo3/src/exceptions.rs Wed Dec 25 19:05:27 2024 +0100 +++ b/rust/hg-pyo3/src/exceptions.rs Wed Dec 25 19:06:59 2024 +0100 @@ -78,3 +78,9 @@ } } } + +pub fn graph_error(_err: hg::GraphError) -> PyErr { + // ParentOutOfRange is currently the only alternative + // in `hg::GraphError`. The C index always raises this simple ValueError. + PyValueError::new_err("parent out of range") +}