Mercurial > hg-stable
changeset 52000:e5dcaf6d4ac0
head-revs: move hg-cpython's inner_headrevsfiltered closer to inner_headrevs
This is pure code movement, it make a coming changesets significantly clearer.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 26 Sep 2024 01:50:36 +0200 |
parents | 22da1dc97281 |
children | 69bfd6b242ed |
files | rust/hg-cpython/src/revlog.rs |
diffstat | 1 files changed, 24 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/rust/hg-cpython/src/revlog.rs Wed Sep 25 17:18:40 2024 +0200 +++ b/rust/hg-cpython/src/revlog.rs Thu Sep 26 01:50:36 2024 +0200 @@ -839,6 +839,30 @@ .into_object()) } + fn inner_headrevsfiltered( + &self, + py: Python, + filtered_revs: &PyObject, + ) -> PyResult<PyObject> { + let index = &*self.index(py).borrow(); + let filtered_revs = rev_pyiter_collect(py, filtered_revs, index)?; + + if let Some(new_heads) = index + .head_revs_filtered(&filtered_revs, true) + .map_err(|e| graph_error(py, e))? + { + self.cache_new_heads_py_list(&new_heads, py); + } + + Ok(self + .head_revs_py_list(py) + .borrow() + .as_ref() + .expect("head revs should be cached") + .clone_ref(py) + .into_object()) + } + fn check_revision( index: &hg::index::Index, rev: UncheckedRevision, @@ -871,30 +895,6 @@ Ok(res) } - fn inner_headrevsfiltered( - &self, - py: Python, - filtered_revs: &PyObject, - ) -> PyResult<PyObject> { - let index = &*self.index(py).borrow(); - let filtered_revs = rev_pyiter_collect(py, filtered_revs, index)?; - - if let Some(new_heads) = index - .head_revs_filtered(&filtered_revs, true) - .map_err(|e| graph_error(py, e))? - { - self.cache_new_heads_py_list(&new_heads, py); - } - - Ok(self - .head_revs_py_list(py) - .borrow() - .as_ref() - .expect("head revs should be cached") - .clone_ref(py) - .into_object()) - } - fn cache_new_heads_node_ids_py_list( &self, new_heads: &[Revision],