Mercurial > public > mercurial-scm > hg
diff rust/hg-pyo3/src/revlog/mod.rs @ 52833:b7dd7af61488
rust-pyo3-revlog: write_pending
author | Rapha?l Gom?s <rgomes@octobus.net> |
---|---|
date | Sun, 05 Jan 2025 23:20:14 +0100 |
parents | c72d8df0c080 |
children | 8ebe20a6fcb7 |
line wrap: on
line diff
--- a/rust/hg-pyo3/src/revlog/mod.rs Sun Jan 05 23:20:01 2025 +0100 +++ b/rust/hg-pyo3/src/revlog/mod.rs Sun Jan 05 23:20:14 2025 +0100 @@ -568,6 +568,26 @@ }) } + fn write_pending( + slf: &Bound<'_, Self>, + py: Python<'_>, + ) -> PyResult<Py<PyTuple>> { + Self::with_core_write(slf, |_self_ref, mut irl| { + let (path, any_pending) = + irl.write_pending().map_err(revlog_error_from_msg)?; + let maybe_path = match path { + Some(path) => PyBytes::new(py, &get_bytes_from_path(path)) + .unbind() + .into_any(), + None => py.None(), + }; + Ok( + PyTuple::new(py, [maybe_path, any_pending.into_py_any(py)?])? + .unbind(), + ) + }) + } + fn finalize_pending( slf: &Bound<'_, Self>, py: Python<'_>,