rust-index: helper for revision not in index not involving nodemap
authorGeorges Racinet <georges.racinet@octobus.net>
Wed, 27 Sep 2023 10:59:04 +0200
changeset 51200 bc4d83047c6c
parent 51199 44fbb7dfb563
child 51201 52bbb57a76ad
rust-index: helper for revision not in index not involving nodemap This is a good match for exceptions raised from the C implementation, when it is not about a nodemap inconsistency.
rust/hg-cpython/src/revlog.rs
--- a/rust/hg-cpython/src/revlog.rs	Wed Oct 18 19:54:18 2023 +0200
+++ b/rust/hg-cpython/src/revlog.rs	Wed Sep 27 10:59:04 2023 +0200
@@ -614,6 +614,14 @@
     )
 }
 
+#[allow(dead_code)]
+fn rev_not_in_index(py: Python, rev: UncheckedRevision) -> PyErr {
+    PyErr::new::<ValueError, _>(
+        py,
+        format!("revlog index out of range: {}", rev),
+    )
+}
+
 /// Standard treatment of NodeMapError
 fn nodemap_error(py: Python, err: NodeMapError) -> PyErr {
     match err {