Mercurial > hg
diff rust/hg-cpython/src/dirstate/dirstate_map.rs @ 47477:eb416759af7e
dirstate: Removed unused instances of `DirsMultiset`
… in Rust-backed dirstatemap.
The Python class `dirstatemap` had cached properties `_dirs` and `_alldirs`
that were not used for `hastrackeddir` and `hasdir` since they were redundant
with corresponding fields for the Rust `DirstateMap` struct.
`dirfoldmap` is modified to reuse instead the directory iterator introduced
in 3b9914b28133c0918186b6e8b9e4f1916e21338d.
Differential Revision: https://phab.mercurial-scm.org/D10921
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Mon, 28 Jun 2021 15:52:10 +0200 |
parents | 3b9914b28133 |
children | eaae39894312 |
line wrap: on
line diff
--- a/rust/hg-cpython/src/dirstate/dirstate_map.rs Mon Jun 28 15:41:50 2021 +0200 +++ b/rust/hg-cpython/src/dirstate/dirstate_map.rs Mon Jun 28 15:52:10 2021 +0200 @@ -19,11 +19,11 @@ use crate::{ dirstate::copymap::{CopyMap, CopyMapItemsIterator, CopyMapKeysIterator}, + dirstate::make_dirstate_tuple, dirstate::non_normal_entries::{ NonNormalEntries, NonNormalEntriesIterator, }, dirstate::owning::OwningDirstateMap, - dirstate::{dirs_multiset::Dirs, make_dirstate_tuple}, parsers::dirstate_parents_to_pytuple, }; use hg::{ @@ -34,8 +34,8 @@ revlog::Node, utils::files::normalize_case, utils::hg_path::{HgPath, HgPathBuf}, - DirsMultiset, DirstateEntry, DirstateError, - DirstateMap as RustDirstateMap, DirstateParents, EntryState, StateMapIter, + DirstateEntry, DirstateError, DirstateMap as RustDirstateMap, + DirstateParents, EntryState, StateMapIter, }; // TODO @@ -391,40 +391,6 @@ ) } - def getdirs(&self) -> PyResult<Dirs> { - // TODO don't copy, share the reference - self.inner(py).borrow_mut().set_dirs() - .map_err(|e| { - PyErr::new::<exc::ValueError, _>(py, e.to_string()) - })?; - Dirs::from_inner( - py, - DirsMultiset::from_dirstate( - self.inner(py).borrow().iter(), - Some(EntryState::Removed), - ) - .map_err(|e| { - PyErr::new::<exc::ValueError, _>(py, e.to_string()) - })?, - ) - } - def getalldirs(&self) -> PyResult<Dirs> { - // TODO don't copy, share the reference - self.inner(py).borrow_mut().set_all_dirs() - .map_err(|e| { - PyErr::new::<exc::ValueError, _>(py, e.to_string()) - })?; - Dirs::from_inner( - py, - DirsMultiset::from_dirstate( - self.inner(py).borrow().iter(), - None, - ).map_err(|e| { - PyErr::new::<exc::ValueError, _>(py, e.to_string()) - })?, - ) - } - // TODO all copymap* methods, see docstring above def copymapcopy(&self) -> PyResult<PyDict> { let dict = PyDict::new(py);