Mercurial > hg-stable
changeset 48063:76f1c76186a1
dirstate: Remove return boolean from dirstatemap.dropfile
None of the remaining callers use it.
Differential Revision: https://phab.mercurial-scm.org/D11491
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Thu, 23 Sep 2021 15:26:33 +0200 |
parents | 9b2a51b2c36a |
children | 29aa633815db |
files | mercurial/dirstatemap.py rust/hg-core/src/dirstate/dirstate_map.rs rust/hg-core/src/dirstate_tree/dirstate_map.rs rust/hg-core/src/dirstate_tree/dispatch.rs rust/hg-core/src/dirstate_tree/owning_dispatch.rs rust/hg-cpython/src/dirstate/dirstate_map.rs |
diffstat | 6 files changed, 17 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/dirstatemap.py Wed Sep 22 18:56:58 2021 +0200 +++ b/mercurial/dirstatemap.py Thu Sep 23 15:26:33 2021 +0200 @@ -695,7 +695,7 @@ def dropfile(self, f, *args, **kwargs): self._rustmap.copymap().pop(f, None) - return self._rustmap.dropfile(f, *args, **kwargs) + self._rustmap.dropfile(f, *args, **kwargs) def clearambiguoustimes(self, *args, **kwargs): return self._rustmap.clearambiguoustimes(*args, **kwargs)
--- a/rust/hg-core/src/dirstate/dirstate_map.rs Wed Sep 22 18:56:58 2021 +0200 +++ b/rust/hg-core/src/dirstate/dirstate_map.rs Thu Sep 23 15:26:33 2021 +0200 @@ -198,7 +198,7 @@ pub fn drop_file( &mut self, filename: &HgPath, - ) -> Result<bool, DirstateError> { + ) -> Result<(), DirstateError> { let old_state = self.get(filename).map(|e| e.state()); let exists = self.state_map.remove(filename).is_some(); @@ -216,7 +216,7 @@ .0 .remove(filename); - Ok(exists) + Ok(()) } pub fn clear_ambiguous_times(
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs Wed Sep 22 18:56:58 2021 +0200 +++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs Thu Sep 23 15:26:33 2021 +0200 @@ -845,7 +845,7 @@ Ok(self.add_or_remove_file(filename, old_state, entry)?) } - fn drop_file(&mut self, filename: &HgPath) -> Result<bool, DirstateError> { + fn drop_file(&mut self, filename: &HgPath) -> Result<(), DirstateError> { let was_tracked = self .get(filename)? .map_or(false, |e| e.state().is_tracked()); @@ -946,11 +946,10 @@ if dropped.had_copy_source { self.nodes_with_copy_source_count -= 1 } - Ok(dropped.had_entry) } else { debug_assert!(!was_tracked); - Ok(false) } + Ok(()) } fn clear_ambiguous_times(
--- a/rust/hg-core/src/dirstate_tree/dispatch.rs Wed Sep 22 18:56:58 2021 +0200 +++ b/rust/hg-core/src/dirstate_tree/dispatch.rs Thu Sep 23 15:26:33 2021 +0200 @@ -81,7 +81,7 @@ /// /// `old_state` is the state in the entry that `get` would have returned /// before this call, or `EntryState::Unknown` if there was no such entry. - fn drop_file(&mut self, filename: &HgPath) -> Result<bool, DirstateError>; + fn drop_file(&mut self, filename: &HgPath) -> Result<(), DirstateError>; /// Among given files, mark the stored `mtime` as ambiguous if there is one /// (if `state == EntryState::Normal`) equal to the given current Unix @@ -354,7 +354,7 @@ self.remove_file(filename, in_merge) } - fn drop_file(&mut self, filename: &HgPath) -> Result<bool, DirstateError> { + fn drop_file(&mut self, filename: &HgPath) -> Result<(), DirstateError> { self.drop_file(filename) }
--- a/rust/hg-core/src/dirstate_tree/owning_dispatch.rs Wed Sep 22 18:56:58 2021 +0200 +++ b/rust/hg-core/src/dirstate_tree/owning_dispatch.rs Thu Sep 23 15:26:33 2021 +0200 @@ -55,7 +55,7 @@ self.get_mut().remove_file(filename, in_merge) } - fn drop_file(&mut self, filename: &HgPath) -> Result<bool, DirstateError> { + fn drop_file(&mut self, filename: &HgPath) -> Result<(), DirstateError> { self.get_mut().drop_file(filename) }
--- a/rust/hg-cpython/src/dirstate/dirstate_map.rs Wed Sep 22 18:56:58 2021 +0200 +++ b/rust/hg-cpython/src/dirstate/dirstate_map.rs Thu Sep 23 15:26:33 2021 +0200 @@ -13,8 +13,8 @@ use cpython::{ exc, ObjectProtocol, PyBool, PyBytes, PyClone, PyDict, PyErr, PyList, - PyObject, PyResult, PySet, PyString, Python, PythonObject, ToPyObject, - UnsafePyLeaked, + PyNone, PyObject, PyResult, PySet, PyString, Python, PythonObject, + ToPyObject, UnsafePyLeaked, }; use crate::{ @@ -212,19 +212,13 @@ def dropfile( &self, - f: PyObject, - ) -> PyResult<PyBool> { - self.inner(py).borrow_mut() - .drop_file( - HgPath::new(f.extract::<PyBytes>(py)?.data(py)), - ) - .and_then(|b| Ok(b.to_py_object(py))) - .or_else(|e| { - Err(PyErr::new::<exc::OSError, _>( - py, - format!("Dirstate error: {}", e.to_string()), - )) - }) + f: PyBytes, + ) -> PyResult<PyNone> { + self.inner(py) + .borrow_mut() + .drop_file(HgPath::new(f.data(py))) + .map_err(|e |dirstate_error(py, e))?; + Ok(PyNone) } def clearambiguoustimes(