Mercurial > public > mercurial-scm > hg
changeset 52809:6bd11e3e05d6
rust-pyo3-revlog: _index_headrevsdiff
author | Georges Racinet <georges.racinet@cloudcrane.io> |
---|---|
date | Tue, 24 Dec 2024 15:09:02 +0100 |
parents | 6222326bd13e |
children | 09544af536ef |
files | rust/hg-pyo3/src/revlog/mod.rs |
diffstat | 1 files changed, 21 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/rust/hg-pyo3/src/revlog/mod.rs Tue Dec 24 14:37:33 2024 +0100 +++ b/rust/hg-pyo3/src/revlog/mod.rs Tue Dec 24 15:09:02 2024 +0100 @@ -573,6 +573,27 @@ } } + /// get diff in head revisions + fn _index_headrevsdiff( + slf: &Bound<'_, Self>, + py: Python<'_>, + begin: PyRevision, + end: PyRevision, + ) -> PyResult<Py<PyTuple>> { + let begin: BaseRevision = begin.0 - 1; + let end: BaseRevision = end.0 - 1; + let (removed, added) = Self::with_index_read(slf, |idx| { + idx.head_revs_diff( + check_revision(idx, begin)?, + check_revision(idx, end)?, + ) + .map_err(graph_error) + })?; + let py_removed = revs_py_list(py, removed)?; + let py_added = revs_py_list(py, added)?; + Ok((py_removed, py_added).into_pyobject(py)?.unbind()) + } + /// True if the object is a snapshot fn _index_issnapshot( slf: &Bound<'_, Self>,