Mercurial > hg
diff rust/hg-cpython/src/dirstate/dirs_multiset.rs @ 43863:bc7d8f45c3b6
rust-dirs: handle forgotten `Result`s
In 1fe2e574616e I introduced a temporary bugfix to align Rust code with a new
behavior from C/Python and forgot about a few `Result`s (cargo's compiler cache
does not re-emit warnings on cached modules). This fixes it.
For the record, I am still unsure that this behavior change is a good idea.
Note: I was already quite unhappy with the setters and getters for the
`DirstateMap` and, indirectly, `Dirs`, and this only further reinforces my
feelings. I hope we can one day fix that situation at the type level; Georges
Racinet and I were just talking about devising a POC for using the builder
pattern in the context of FFI with Python, we'll see what comes out of it.
Differential Revision: https://phab.mercurial-scm.org/D7609
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Thu, 12 Dec 2019 15:55:25 +0100 |
parents | 1fe2e574616e |
children | 2a24ead003f0 |
line wrap: on
line diff
--- a/rust/hg-cpython/src/dirstate/dirs_multiset.rs Fri Dec 13 09:43:43 2019 -0800 +++ b/rust/hg-cpython/src/dirstate/dirs_multiset.rs Thu Dec 12 15:55:25 2019 +0100 @@ -47,6 +47,9 @@ let inner = if let Ok(map) = map.cast_as::<PyDict>(py) { let dirstate = extract_dirstate(py, &map)?; DirsMultiset::from_dirstate(&dirstate, skip_state) + .map_err(|e| { + PyErr::new::<exc::ValueError, _>(py, e.to_string()) + })? } else { let map: Result<Vec<HgPathBuf>, PyErr> = map .iter(py)? @@ -57,6 +60,9 @@ }) .collect(); DirsMultiset::from_manifest(&map?) + .map_err(|e| { + PyErr::new::<exc::ValueError, _>(py, e.to_string()) + })? }; Self::create_instance(