Mercurial > public > mercurial-scm > hg-stable
changeset 52837:14824d621c2c
rust-pyo3-revlog: _chunk
author | Rapha?l Gom?s <rgomes@octobus.net> |
---|---|
date | Fri, 03 Jan 2025 12:45:33 +0100 |
parents | 9435a212a773 |
children | 1cd75e5d6347 |
files | rust/hg-pyo3/src/revlog/mod.rs |
diffstat | 1 files changed, 13 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/rust/hg-pyo3/src/revlog/mod.rs Fri Jan 03 12:44:08 2025 +0100 +++ b/rust/hg-pyo3/src/revlog/mod.rs Fri Jan 03 12:45:33 2025 +0100 @@ -393,6 +393,19 @@ }) } + fn _chunk( + slf: &Bound<'_, Self>, + py: Python<'_>, + rev: PyRevision, + ) -> PyResult<Py<PyBytes>> { + Self::with_core_read(slf, |_self_ref, irl| { + let chunk = irl + .chunk_for_rev(Revision(rev.0)) + .map_err(revlog_error_from_msg)?; + Ok(PyBytes::new(py, &chunk).unbind()) + }) + } + fn reading(slf: &Bound<'_, Self>) -> PyResult<ReadingContextManager> { Ok(ReadingContextManager { inner_revlog: slf.clone().unbind(),