comparison rust/hg-core/src/dirstate_tree/dispatch.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 32ef647821b2
children 76f1c76186a1
comparison
equal deleted inserted replaced
48046:f6d0a89fdf80 48047:9b2a51b2c36a
37 /// Remove information about all files in this map 37 /// Remove information about all files in this map
38 fn clear(&mut self); 38 fn clear(&mut self);
39 39
40 /// Add the given filename to the map if it is not already there, and 40 /// Add the given filename to the map if it is not already there, and
41 /// associate the given entry with it. 41 /// associate the given entry with it.
42 fn set_entry(&mut self, filename: &HgPath, entry: DirstateEntry); 42 fn set_entry(
43 &mut self,
44 filename: &HgPath,
45 entry: DirstateEntry,
46 ) -> Result<(), DirstateV2ParseError>;
43 47
44 /// Add or change the information associated to a given file. 48 /// Add or change the information associated to a given file.
45 /// 49 ///
46 /// `old_state` is the state in the entry that `get` would have returned 50 /// `old_state` is the state in the entry that `get` would have returned
47 /// before this call, or `EntryState::Unknown` if there was no such entry. 51 /// before this call, or `EntryState::Unknown` if there was no such entry.
319 323
320 /// Used to set a value directory. 324 /// Used to set a value directory.
321 /// 325 ///
322 /// XXX Is temporary during a refactor of V1 dirstate and will disappear 326 /// XXX Is temporary during a refactor of V1 dirstate and will disappear
323 /// shortly. 327 /// shortly.
324 fn set_entry(&mut self, filename: &HgPath, entry: DirstateEntry) { 328 fn set_entry(
325 self.set_entry(&filename, entry) 329 &mut self,
330 filename: &HgPath,
331 entry: DirstateEntry,
332 ) -> Result<(), DirstateV2ParseError> {
333 self.set_entry(&filename, entry);
334 Ok(())
326 } 335 }
327 336
328 fn add_file( 337 fn add_file(
329 &mut self, 338 &mut self,
330 filename: &HgPath, 339 filename: &HgPath,