Mercurial > public > mercurial-scm > hg
comparison rust/hg-cpython/src/revlog.rs @ 51232:456e0fe702e8
rust-index: honour incoming using_general_delta in `deltachain`
It looks to be a leftover from some past, but the C index considers
only the value passed from Python whereas up to now the Rust index
was using the value of its attribute.
As a middle ground, we make this argument of `deltachain` optional from
the Python side, with the Rust implementation only defaulting to its
attribute. This way, we reduce false leads when a difference in results
is spotted.
author | Georges Racinet on incendie.racinet.fr <georges@racinet.fr> |
---|---|
date | Fri, 27 Oct 2023 23:21:50 +0200 |
parents | 59183a19954e |
children | 7eea2e4109ae |
comparison
equal
deleted
inserted
replaced
51231:59183a19954e | 51232:456e0fe702e8 |
---|---|
366 let stop_rev = UncheckedRevision(stop_rev); | 366 let stop_rev = UncheckedRevision(stop_rev); |
367 Some(index.check_revision(stop_rev).ok_or_else(|| { | 367 Some(index.check_revision(stop_rev).ok_or_else(|| { |
368 nodemap_error(py, NodeMapError::RevisionNotInIndex(stop_rev)) | 368 nodemap_error(py, NodeMapError::RevisionNotInIndex(stop_rev)) |
369 })?) | 369 })?) |
370 } else {None}; | 370 } else {None}; |
371 let (chain, stopped) = index.delta_chain(rev, stop_rev).map_err(|e| { | 371 let using_general_delta = args.get_item(py, 2) |
372 .extract::<Option<u32>>(py)? | |
373 .map(|i| i != 0); | |
374 let (chain, stopped) = index.delta_chain( | |
375 rev, stop_rev, using_general_delta | |
376 ).map_err(|e| { | |
372 PyErr::new::<cpython::exc::ValueError, _>(py, e.to_string()) | 377 PyErr::new::<cpython::exc::ValueError, _>(py, e.to_string()) |
373 })?; | 378 })?; |
374 | 379 |
375 let cresult = self.call_cindex(py, "deltachain", args, kw)?; | 380 let cresult = self.call_cindex(py, "deltachain", args, kw)?; |
376 let cchain: Vec<BaseRevision> = | 381 let cchain: Vec<BaseRevision> = |