comparison rust/hg-cpython/src/dirstate/dirstate_map.rs @ 47535:6025353c9c55

dirstate: no longer pass `oldstate` to the `dropfile` The `oldstate` value come literally from `_map` so we don't need to pass tha information along. Differential Revision: https://phab.mercurial-scm.org/D10978
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 04 Jul 2021 02:28:08 +0200
parents a1745a292885
children 84391ddf4c78
comparison
equal deleted inserted replaced
47534:e53a42dce923 47535:6025353c9c55
30 dirstate::parsers::Timestamp, 30 dirstate::parsers::Timestamp,
31 dirstate::MTIME_UNSET, 31 dirstate::MTIME_UNSET,
32 dirstate::SIZE_NON_NORMAL, 32 dirstate::SIZE_NON_NORMAL,
33 dirstate_tree::dispatch::DirstateMapMethods, 33 dirstate_tree::dispatch::DirstateMapMethods,
34 dirstate_tree::on_disk::DirstateV2ParseError, 34 dirstate_tree::on_disk::DirstateV2ParseError,
35 errors::HgError,
36 revlog::Node, 35 revlog::Node,
37 utils::files::normalize_case, 36 utils::files::normalize_case,
38 utils::hg_path::{HgPath, HgPathBuf}, 37 utils::hg_path::{HgPath, HgPathBuf},
39 DirstateEntry, DirstateError, DirstateMap as RustDirstateMap, 38 DirstateEntry, DirstateError, DirstateMap as RustDirstateMap,
40 DirstateParents, EntryState, StateMapIter, 39 DirstateParents, EntryState, StateMapIter,
179 } 178 }
180 179
181 def dropfile( 180 def dropfile(
182 &self, 181 &self,
183 f: PyObject, 182 f: PyObject,
184 oldstate: PyObject
185 ) -> PyResult<PyBool> { 183 ) -> PyResult<PyBool> {
186 self.inner(py).borrow_mut() 184 self.inner(py).borrow_mut()
187 .drop_file( 185 .drop_file(
188 HgPath::new(f.extract::<PyBytes>(py)?.data(py)), 186 HgPath::new(f.extract::<PyBytes>(py)?.data(py)),
189 oldstate.extract::<PyBytes>(py)?.data(py)[0]
190 .try_into()
191 .map_err(|e: HgError| {
192 PyErr::new::<exc::ValueError, _>(py, e.to_string())
193 })?,
194 ) 187 )
195 .and_then(|b| Ok(b.to_py_object(py))) 188 .and_then(|b| Ok(b.to_py_object(py)))
196 .or_else(|e| { 189 .or_else(|e| {
197 Err(PyErr::new::<exc::OSError, _>( 190 Err(PyErr::new::<exc::OSError, _>(
198 py, 191 py,