head-revs: move hg-cpython's inner_headrevsfiltered closer to inner_headrevs
This is pure code movement, it make a coming changesets significantly clearer.
--- 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],