Mercurial > hg-stable
changeset 49166:8a17fc501eda
rust-dirstatemap: remove `removefile` API
Its callers have been migrated to the newer dirstate API.
Differential Revision: https://phab.mercurial-scm.org/D12509
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Wed, 23 Mar 2022 17:16:10 +0100 |
parents | 4d3f6767319f |
children | a55934393078 |
files | rust/hg-core/src/dirstate_tree/dirstate_map.rs rust/hg-cpython/src/dirstate/dirstate_map.rs |
diffstat | 2 files changed, 0 insertions(+), 55 deletions(-) [+] |
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs Mon Mar 28 18:26:24 2022 +0200 +++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs Wed Mar 23 17:16:10 2022 +0100 @@ -15,8 +15,6 @@ use crate::dirstate::ParentFileData; use crate::dirstate::StateMapIter; use crate::dirstate::TruncatedTimestamp; -use crate::dirstate::SIZE_FROM_OTHER_PARENT; -use crate::dirstate::SIZE_NON_NORMAL; use crate::matchers::Matcher; use crate::utils::hg_path::{HgPath, HgPathBuf}; use crate::DirstateEntry; @@ -1051,40 +1049,6 @@ }) } - pub fn remove_file( - &mut self, - filename: &HgPath, - in_merge: bool, - ) -> Result<(), DirstateError> { - let old_entry_opt = self.get(filename)?; - let old_state = old_entry_opt.map(|e| e.state()); - let mut size = 0; - if in_merge { - // XXX we should not be able to have 'm' state and 'FROM_P2' if not - // during a merge. So I (marmoute) am not sure we need the - // conditionnal at all. Adding double checking this with assert - // would be nice. - if let Some(old_entry) = old_entry_opt { - // backup the previous state - if old_entry.state() == EntryState::Merged { - size = SIZE_NON_NORMAL; - } else if old_entry.state() == EntryState::Normal - && old_entry.size() == SIZE_FROM_OTHER_PARENT - { - // other parent - size = SIZE_FROM_OTHER_PARENT; - } - } - } - if size == 0 { - self.copy_map_remove(filename)?; - } - self.with_dmap_mut(|map| { - let entry = DirstateEntry::new_removed(size); - Ok(map.add_or_remove_file(filename, old_state, entry)?) - }) - } - pub fn drop_entry_and_copy_source( &mut self, filename: &HgPath,
--- a/rust/hg-cpython/src/dirstate/dirstate_map.rs Mon Mar 28 18:26:24 2022 +0200 +++ b/rust/hg-cpython/src/dirstate/dirstate_map.rs Wed Mar 23 17:16:10 2022 +0100 @@ -233,25 +233,6 @@ Ok(PyNone) } - def removefile( - &self, - f: PyObject, - in_merge: PyObject - ) -> PyResult<PyObject> { - self.inner(py).borrow_mut() - .remove_file( - HgPath::new(f.extract::<PyBytes>(py)?.data(py)), - in_merge.extract::<PyBool>(py)?.is_true(), - ) - .or_else(|_| { - Err(PyErr::new::<exc::OSError, _>( - py, - "Dirstate error".to_string(), - )) - })?; - Ok(py.None()) - } - def drop_item_and_copy_source( &self, f: PyBytes,