# HG changeset patch # User Pierre-Yves David # Date 1727308236 -7200 # Node ID e5dcaf6d4ac0c0c650a69bbd2e1ee3d74ba62433 # Parent 22da1dc97281ae7b386e2497db2ca1dcc322d8a3 head-revs: move hg-cpython's inner_headrevsfiltered closer to inner_headrevs This is pure code movement, it make a coming changesets significantly clearer. diff -r 22da1dc97281 -r e5dcaf6d4ac0 rust/hg-cpython/src/revlog.rs --- 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 { + 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 { - 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],