Mercurial > hg
diff rust/hg-cpython/src/revlog.rs @ 51211:b8c89957a6b7
rust-index: add `is_snapshot` method
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Thu, 03 Aug 2023 12:05:32 +0200 |
parents | 72d16685d63a |
children | 9b06e7f32bc5 |
line wrap: on
line diff
--- a/rust/hg-cpython/src/revlog.rs Wed Aug 02 16:49:33 2023 +0200 +++ b/rust/hg-cpython/src/revlog.rs Thu Aug 03 12:05:32 2023 +0200 @@ -257,8 +257,16 @@ } /// True if the object is a snapshot - def issnapshot(&self, *args, **kw) -> PyResult<PyObject> { - self.call_cindex(py, "issnapshot", args, kw) + def issnapshot(&self, *args, **kw) -> PyResult<bool> { + let index = self.index(py).borrow(); + let result = index + .is_snapshot(UncheckedRevision(args.get_item(py, 0).extract(py)?)) + .map_err(|e| { + PyErr::new::<cpython::exc::ValueError, _>(py, e.to_string()) + })?; + let cresult = self.call_cindex(py, "issnapshot", args, kw)?; + assert_eq!(result, cresult.extract(py)?); + Ok(result) } /// Gather snapshot data in a cache dict