rust/hg-cpython/src/revlog.rs
changeset 51962 fb4d49c52c06
parent 51464 68ed56baabf5
child 51964 8060257fd918
--- a/rust/hg-cpython/src/revlog.rs	Wed Sep 25 16:38:31 2024 +0200
+++ b/rust/hg-cpython/src/revlog.rs	Wed Sep 25 21:43:21 2024 +0200
@@ -304,8 +304,17 @@
     }
 
     /// get head revisions
-    def headrevs(&self) -> PyResult<PyObject> {
-        let rust_res = self.inner_headrevs(py)?;
+    def headrevs(&self, *args, **_kw) -> PyResult<PyObject> {
+        let filtered_revs = match &args.len(py) {
+             0 => Ok(py.None()),
+             1 => Ok(args.get_item(py, 0)),
+             _ => Err(PyErr::new::<cpython::exc::TypeError, _>(py, "too many arguments")),
+        }?;
+        let rust_res = if filtered_revs.is_none(py) {
+            self.inner_headrevs(py)
+        } else {
+            self.inner_headrevsfiltered(py, &filtered_revs)
+        }?;
         Ok(rust_res)
     }