##// END OF EJS Templates
rust-dirstatemap: remove `removefile` API...
Raphaël Gomès -
r50002:8a17fc50 default
parent child Browse files
Show More
@@ -15,8 +15,6 b' use crate::dirstate::DirstateV2Data;'
15 use crate::dirstate::ParentFileData;
15 use crate::dirstate::ParentFileData;
16 use crate::dirstate::StateMapIter;
16 use crate::dirstate::StateMapIter;
17 use crate::dirstate::TruncatedTimestamp;
17 use crate::dirstate::TruncatedTimestamp;
18 use crate::dirstate::SIZE_FROM_OTHER_PARENT;
19 use crate::dirstate::SIZE_NON_NORMAL;
20 use crate::matchers::Matcher;
18 use crate::matchers::Matcher;
21 use crate::utils::hg_path::{HgPath, HgPathBuf};
19 use crate::utils::hg_path::{HgPath, HgPathBuf};
22 use crate::DirstateEntry;
20 use crate::DirstateEntry;
@@ -1051,40 +1049,6 b' impl OwningDirstateMap {'
1051 })
1049 })
1052 }
1050 }
1053
1051
1054 pub fn remove_file(
1055 &mut self,
1056 filename: &HgPath,
1057 in_merge: bool,
1058 ) -> Result<(), DirstateError> {
1059 let old_entry_opt = self.get(filename)?;
1060 let old_state = old_entry_opt.map(|e| e.state());
1061 let mut size = 0;
1062 if in_merge {
1063 // XXX we should not be able to have 'm' state and 'FROM_P2' if not
1064 // during a merge. So I (marmoute) am not sure we need the
1065 // conditionnal at all. Adding double checking this with assert
1066 // would be nice.
1067 if let Some(old_entry) = old_entry_opt {
1068 // backup the previous state
1069 if old_entry.state() == EntryState::Merged {
1070 size = SIZE_NON_NORMAL;
1071 } else if old_entry.state() == EntryState::Normal
1072 && old_entry.size() == SIZE_FROM_OTHER_PARENT
1073 {
1074 // other parent
1075 size = SIZE_FROM_OTHER_PARENT;
1076 }
1077 }
1078 }
1079 if size == 0 {
1080 self.copy_map_remove(filename)?;
1081 }
1082 self.with_dmap_mut(|map| {
1083 let entry = DirstateEntry::new_removed(size);
1084 Ok(map.add_or_remove_file(filename, old_state, entry)?)
1085 })
1086 }
1087
1088 pub fn drop_entry_and_copy_source(
1052 pub fn drop_entry_and_copy_source(
1089 &mut self,
1053 &mut self,
1090 filename: &HgPath,
1054 filename: &HgPath,
@@ -233,25 +233,6 b' py_class!(pub class DirstateMap |py| {'
233 Ok(PyNone)
233 Ok(PyNone)
234 }
234 }
235
235
236 def removefile(
237 &self,
238 f: PyObject,
239 in_merge: PyObject
240 ) -> PyResult<PyObject> {
241 self.inner(py).borrow_mut()
242 .remove_file(
243 HgPath::new(f.extract::<PyBytes>(py)?.data(py)),
244 in_merge.extract::<PyBool>(py)?.is_true(),
245 )
246 .or_else(|_| {
247 Err(PyErr::new::<exc::OSError, _>(
248 py,
249 "Dirstate error".to_string(),
250 ))
251 })?;
252 Ok(py.None())
253 }
254
255 def drop_item_and_copy_source(
236 def drop_item_and_copy_source(
256 &self,
237 &self,
257 f: PyBytes,
238 f: PyBytes,
General Comments 0
You need to be logged in to leave comments. Login now