comparison rust/hg-cpython/src/revlog.rs @ 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
comparison
equal deleted inserted replaced
51247:8dbd985733ff 51248:8b243e2a3bc4
12 PyRevision, 12 PyRevision,
13 }; 13 };
14 use cpython::{ 14 use cpython::{
15 buffer::{Element, PyBuffer}, 15 buffer::{Element, PyBuffer},
16 exc::{IndexError, ValueError}, 16 exc::{IndexError, ValueError},
17 ObjectProtocol, PyBytes, PyClone, PyDict, PyErr, PyInt, PyList, PyModule, 17 ObjectProtocol, PyBool, PyBytes, PyClone, PyDict, PyErr, PyInt, PyList,
18 PyObject, PyResult, PySet, PyString, PyTuple, Python, PythonObject, 18 PyModule, PyObject, PyResult, PySet, PyString, PyTuple, Python,
19 ToPyObject, UnsafePyLeaked, 19 PythonObject, ToPyObject, UnsafePyLeaked,
20 }; 20 };
21 use hg::{ 21 use hg::{
22 errors::HgError, 22 errors::HgError,
23 index::{ 23 index::{
24 IndexHeader, Phase, RevisionDataParams, SnapshotsCache, 24 IndexHeader, Phase, RevisionDataParams, SnapshotsCache,
447 def rust_ext_compat(&self) -> PyResult<PyInt> { 447 def rust_ext_compat(&self) -> PyResult<PyInt> {
448 // will be entirely removed when the Rust index yet useful to 448 // will be entirely removed when the Rust index yet useful to
449 // implement in Rust to detangle things when removing `self.cindex` 449 // implement in Rust to detangle things when removing `self.cindex`
450 let rust_res: PyInt = 1.to_py_object(py); 450 let rust_res: PyInt = 1.to_py_object(py);
451 Ok(rust_res) 451 Ok(rust_res)
452 }
453
454 @property
455 def is_rust(&self) -> PyResult<PyBool> {
456 Ok(false.to_py_object(py))
452 } 457 }
453 458
454 }); 459 });
455 460
456 /// Take a (potentially) mmap'ed buffer, and return the underlying Python 461 /// Take a (potentially) mmap'ed buffer, and return the underlying Python