rust-index: a property to identify the Rust index as such
authorGeorges Racinet <georges.racinet@octobus.net>
Mon, 30 Oct 2023 21:25:28 +0100
changeset 51269 8b243e2a3bc4
parent 51268 8dbd985733ff
child 51270 2966b88d4531
rust-index: a property to identify the Rust index as such Will be useful soon in `mercurial.scmutil` and potentially elsewhere
rust/hg-cpython/src/revlog.rs
--- a/rust/hg-cpython/src/revlog.rs	Mon Oct 30 15:32:33 2023 +0100
+++ b/rust/hg-cpython/src/revlog.rs	Mon Oct 30 21:25:28 2023 +0100
@@ -14,9 +14,9 @@
 use cpython::{
     buffer::{Element, PyBuffer},
     exc::{IndexError, ValueError},
-    ObjectProtocol, PyBytes, PyClone, PyDict, PyErr, PyInt, PyList, PyModule,
-    PyObject, PyResult, PySet, PyString, PyTuple, Python, PythonObject,
-    ToPyObject, UnsafePyLeaked,
+    ObjectProtocol, PyBool, PyBytes, PyClone, PyDict, PyErr, PyInt, PyList,
+    PyModule, PyObject, PyResult, PySet, PyString, PyTuple, Python,
+    PythonObject, ToPyObject, UnsafePyLeaked,
 };
 use hg::{
     errors::HgError,
@@ -451,6 +451,11 @@
         Ok(rust_res)
     }
 
+    @property
+    def is_rust(&self) -> PyResult<PyBool> {
+        Ok(false.to_py_object(py))
+    }
+
 });
 
 /// Take a (potentially) mmap'ed buffer, and return the underlying Python