Mercurial > hg
diff rust/hg-core/src/dirstate_tree/dirstate_map.rs @ 48047:9b2a51b2c36a
dirstate: Propagate dirstate-v2 parse errors from set_dirstate_item
… so that Python sees a proper ValueError instead of only
`SystemError: Rust panic`
Differential Revision: https://phab.mercurial-scm.org/D11489
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Wed, 22 Sep 2021 18:56:58 +0200 |
parents | f6d0a89fdf80 |
children | 76f1c76186a1 |
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs Wed Sep 22 18:42:00 2021 +0200 +++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs Wed Sep 22 18:56:58 2021 +0200 @@ -758,10 +758,13 @@ self.nodes_with_copy_source_count = 0; } - fn set_entry(&mut self, filename: &HgPath, entry: DirstateEntry) { - let node = - self.get_or_insert(&filename).expect("no parse error in v1"); - node.data = NodeData::Entry(entry); + fn set_entry( + &mut self, + filename: &HgPath, + entry: DirstateEntry, + ) -> Result<(), DirstateV2ParseError> { + self.get_or_insert(&filename)?.data = NodeData::Entry(entry); + Ok(()) } fn add_file(