##// END OF EJS Templates
dirstate: Propagate dirstate-v2 parse errors from set_dirstate_item...
Simon Sapin -
r48861:9b2a51b2 default
parent child Browse files
Show More
@@ -758,10 +758,13 b" impl<'on_disk> super::dispatch::Dirstate"
758 self.nodes_with_copy_source_count = 0;
758 self.nodes_with_copy_source_count = 0;
759 }
759 }
760
760
761 fn set_entry(&mut self, filename: &HgPath, entry: DirstateEntry) {
761 fn set_entry(
762 let node =
762 &mut self,
763 self.get_or_insert(&filename).expect("no parse error in v1");
763 filename: &HgPath,
764 node.data = NodeData::Entry(entry);
764 entry: DirstateEntry,
765 ) -> Result<(), DirstateV2ParseError> {
766 self.get_or_insert(&filename)?.data = NodeData::Entry(entry);
767 Ok(())
765 }
768 }
766
769
767 fn add_file(
770 fn add_file(
@@ -39,7 +39,11 b' pub trait DirstateMapMethods {'
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 ///
@@ -321,8 +325,13 b' impl DirstateMapMethods for DirstateMap '
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(
@@ -20,7 +20,11 b' impl DirstateMapMethods for OwningDirsta'
20 self.get_mut().clear()
20 self.get_mut().clear()
21 }
21 }
22
22
23 fn set_entry(&mut self, filename: &HgPath, entry: DirstateEntry) {
23 fn set_entry(
24 &mut self,
25 filename: &HgPath,
26 entry: DirstateEntry,
27 ) -> Result<(), DirstateV2ParseError> {
24 self.get_mut().set_entry(filename, entry)
28 self.get_mut().set_entry(filename, entry)
25 }
29 }
26
30
@@ -136,7 +136,10 b' py_class!(pub class DirstateMap |py| {'
136 ) -> PyResult<PyObject> {
136 ) -> PyResult<PyObject> {
137 let f = path.extract::<PyBytes>(py)?;
137 let f = path.extract::<PyBytes>(py)?;
138 let filename = HgPath::new(f.data(py));
138 let filename = HgPath::new(f.data(py));
139 self.inner(py).borrow_mut().set_entry(filename, item.get_entry(py));
139 self.inner(py)
140 .borrow_mut()
141 .set_entry(filename, item.get_entry(py))
142 .map_err(|e| v2_error(py, e))?;
140 Ok(py.None())
143 Ok(py.None())
141 }
144 }
142
145
General Comments 0
You need to be logged in to leave comments. Login now