comparison rust/hg-cpython/src/revlog.rs @ 51962:fb4d49c52c06

rust-cpython: also accept the `filteredrevs` argument in index.headrevs The C version have been accepting this argument since Mercurial 3.2, lets align the Rust index here. This will make it possible to simplify the code in later changesets.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 25 Sep 2024 21:43:21 +0200
parents 68ed56baabf5
children 8060257fd918
comparison
equal deleted inserted replaced
51961:145f66ea1664 51962:fb4d49c52c06
302 )?; 302 )?;
303 Ok(rust_res) 303 Ok(rust_res)
304 } 304 }
305 305
306 /// get head revisions 306 /// get head revisions
307 def headrevs(&self) -> PyResult<PyObject> { 307 def headrevs(&self, *args, **_kw) -> PyResult<PyObject> {
308 let rust_res = self.inner_headrevs(py)?; 308 let filtered_revs = match &args.len(py) {
309 0 => Ok(py.None()),
310 1 => Ok(args.get_item(py, 0)),
311 _ => Err(PyErr::new::<cpython::exc::TypeError, _>(py, "too many arguments")),
312 }?;
313 let rust_res = if filtered_revs.is_none(py) {
314 self.inner_headrevs(py)
315 } else {
316 self.inner_headrevsfiltered(py, &filtered_revs)
317 }?;
309 Ok(rust_res) 318 Ok(rust_res)
310 } 319 }
311 320
312 /// get head nodeids 321 /// get head nodeids
313 def head_node_ids(&self) -> PyResult<PyObject> { 322 def head_node_ids(&self) -> PyResult<PyObject> {