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