changeset 51248:8b243e2a3bc4

rust-index: a property to identify the Rust index as such Will be useful soon in `mercurial.scmutil` and potentially elsewhere
author Georges Racinet <georges.racinet@octobus.net>
date Mon, 30 Oct 2023 21:25:28 +0100
parents 8dbd985733ff
children 2966b88d4531
files rust/hg-cpython/src/revlog.rs
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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