##// END OF EJS Templates
dirstate: Remove return boolean from dirstatemap.dropfile...
Simon Sapin -
r48862:76f1c761 default
parent child Browse files
Show More
@@ -695,7 +695,7 b' if rustmod is not None:'
695
695
696 def dropfile(self, f, *args, **kwargs):
696 def dropfile(self, f, *args, **kwargs):
697 self._rustmap.copymap().pop(f, None)
697 self._rustmap.copymap().pop(f, None)
698 return self._rustmap.dropfile(f, *args, **kwargs)
698 self._rustmap.dropfile(f, *args, **kwargs)
699
699
700 def clearambiguoustimes(self, *args, **kwargs):
700 def clearambiguoustimes(self, *args, **kwargs):
701 return self._rustmap.clearambiguoustimes(*args, **kwargs)
701 return self._rustmap.clearambiguoustimes(*args, **kwargs)
@@ -198,7 +198,7 b' impl DirstateMap {'
198 pub fn drop_file(
198 pub fn drop_file(
199 &mut self,
199 &mut self,
200 filename: &HgPath,
200 filename: &HgPath,
201 ) -> Result<bool, DirstateError> {
201 ) -> Result<(), DirstateError> {
202 let old_state = self.get(filename).map(|e| e.state());
202 let old_state = self.get(filename).map(|e| e.state());
203 let exists = self.state_map.remove(filename).is_some();
203 let exists = self.state_map.remove(filename).is_some();
204
204
@@ -216,7 +216,7 b' impl DirstateMap {'
216 .0
216 .0
217 .remove(filename);
217 .remove(filename);
218
218
219 Ok(exists)
219 Ok(())
220 }
220 }
221
221
222 pub fn clear_ambiguous_times(
222 pub fn clear_ambiguous_times(
@@ -845,7 +845,7 b" impl<'on_disk> super::dispatch::Dirstate"
845 Ok(self.add_or_remove_file(filename, old_state, entry)?)
845 Ok(self.add_or_remove_file(filename, old_state, entry)?)
846 }
846 }
847
847
848 fn drop_file(&mut self, filename: &HgPath) -> Result<bool, DirstateError> {
848 fn drop_file(&mut self, filename: &HgPath) -> Result<(), DirstateError> {
849 let was_tracked = self
849 let was_tracked = self
850 .get(filename)?
850 .get(filename)?
851 .map_or(false, |e| e.state().is_tracked());
851 .map_or(false, |e| e.state().is_tracked());
@@ -946,11 +946,10 b" impl<'on_disk> super::dispatch::Dirstate"
946 if dropped.had_copy_source {
946 if dropped.had_copy_source {
947 self.nodes_with_copy_source_count -= 1
947 self.nodes_with_copy_source_count -= 1
948 }
948 }
949 Ok(dropped.had_entry)
950 } else {
949 } else {
951 debug_assert!(!was_tracked);
950 debug_assert!(!was_tracked);
952 Ok(false)
953 }
951 }
952 Ok(())
954 }
953 }
955
954
956 fn clear_ambiguous_times(
955 fn clear_ambiguous_times(
@@ -81,7 +81,7 b' pub trait DirstateMapMethods {'
81 ///
81 ///
82 /// `old_state` is the state in the entry that `get` would have returned
82 /// `old_state` is the state in the entry that `get` would have returned
83 /// before this call, or `EntryState::Unknown` if there was no such entry.
83 /// before this call, or `EntryState::Unknown` if there was no such entry.
84 fn drop_file(&mut self, filename: &HgPath) -> Result<bool, DirstateError>;
84 fn drop_file(&mut self, filename: &HgPath) -> Result<(), DirstateError>;
85
85
86 /// Among given files, mark the stored `mtime` as ambiguous if there is one
86 /// Among given files, mark the stored `mtime` as ambiguous if there is one
87 /// (if `state == EntryState::Normal`) equal to the given current Unix
87 /// (if `state == EntryState::Normal`) equal to the given current Unix
@@ -354,7 +354,7 b' impl DirstateMapMethods for DirstateMap '
354 self.remove_file(filename, in_merge)
354 self.remove_file(filename, in_merge)
355 }
355 }
356
356
357 fn drop_file(&mut self, filename: &HgPath) -> Result<bool, DirstateError> {
357 fn drop_file(&mut self, filename: &HgPath) -> Result<(), DirstateError> {
358 self.drop_file(filename)
358 self.drop_file(filename)
359 }
359 }
360
360
@@ -55,7 +55,7 b' impl DirstateMapMethods for OwningDirsta'
55 self.get_mut().remove_file(filename, in_merge)
55 self.get_mut().remove_file(filename, in_merge)
56 }
56 }
57
57
58 fn drop_file(&mut self, filename: &HgPath) -> Result<bool, DirstateError> {
58 fn drop_file(&mut self, filename: &HgPath) -> Result<(), DirstateError> {
59 self.get_mut().drop_file(filename)
59 self.get_mut().drop_file(filename)
60 }
60 }
61
61
@@ -13,8 +13,8 b' use std::convert::TryInto;'
13
13
14 use cpython::{
14 use cpython::{
15 exc, ObjectProtocol, PyBool, PyBytes, PyClone, PyDict, PyErr, PyList,
15 exc, ObjectProtocol, PyBool, PyBytes, PyClone, PyDict, PyErr, PyList,
16 PyObject, PyResult, PySet, PyString, Python, PythonObject, ToPyObject,
16 PyNone, PyObject, PyResult, PySet, PyString, Python, PythonObject,
17 UnsafePyLeaked,
17 ToPyObject, UnsafePyLeaked,
18 };
18 };
19
19
20 use crate::{
20 use crate::{
@@ -212,19 +212,13 b' py_class!(pub class DirstateMap |py| {'
212
212
213 def dropfile(
213 def dropfile(
214 &self,
214 &self,
215 f: PyObject,
215 f: PyBytes,
216 ) -> PyResult<PyBool> {
216 ) -> PyResult<PyNone> {
217 self.inner(py).borrow_mut()
217 self.inner(py)
218 .drop_file(
218 .borrow_mut()
219 HgPath::new(f.extract::<PyBytes>(py)?.data(py)),
219 .drop_file(HgPath::new(f.data(py)))
220 )
220 .map_err(|e |dirstate_error(py, e))?;
221 .and_then(|b| Ok(b.to_py_object(py)))
221 Ok(PyNone)
222 .or_else(|e| {
223 Err(PyErr::new::<exc::OSError, _>(
224 py,
225 format!("Dirstate error: {}", e.to_string()),
226 ))
227 })
228 }
222 }
229
223
230 def clearambiguoustimes(
224 def clearambiguoustimes(
General Comments 0
You need to be logged in to leave comments. Login now