comparison rust/hg-cpython/src/dirstate/dirstate_map.rs @ 44362:c089a0947f3e

rust-dirstatemap: directly return `non_normal` and `other_entries` This cleans up the interface which I previously thought needed to be uglier than in reality. No performance difference, simple refactoring. Differential Revision: https://phab.mercurial-scm.org/D8121
author Raphaël Gomès <rgomes@octobus.net>
date Fri, 14 Feb 2020 15:03:26 +0100
parents a69c08cdb2a8
children 8ac5726d695d
comparison
equal deleted inserted replaced
44361:27a78ea30b48 44362:c089a0947f3e
173 173
174 let locals = PyDict::new(py); 174 let locals = PyDict::new(py);
175 locals.set_item( 175 locals.set_item(
176 py, 176 py,
177 "other_parent", 177 "other_parent",
178 other_parent.as_ref() 178 other_parent
179 .unwrap()
180 .iter() 179 .iter()
181 .map(|v| PyBytes::new(py, v.as_ref())) 180 .map(|v| PyBytes::new(py, v.as_ref()))
182 .collect::<Vec<PyBytes>>() 181 .collect::<Vec<PyBytes>>()
183 .to_py_object(py), 182 .to_py_object(py),
184 )?; 183 )?;
194 let key = key.extract::<PyBytes>(py)?; 193 let key = key.extract::<PyBytes>(py)?;
195 Ok(self 194 Ok(self
196 .inner(py) 195 .inner(py)
197 .borrow_mut() 196 .borrow_mut()
198 .get_non_normal_other_parent_entries().0 197 .get_non_normal_other_parent_entries().0
199 .as_ref()
200 .unwrap()
201 .contains(HgPath::new(key.data(py)))) 198 .contains(HgPath::new(key.data(py))))
202 } 199 }
203 200
204 def non_normal_entries_display(&self) -> PyResult<PyString> { 201 def non_normal_entries_display(&self) -> PyResult<PyString> {
205 Ok( 202 Ok(
209 "NonNormalEntries: {:?}", 206 "NonNormalEntries: {:?}",
210 self 207 self
211 .inner(py) 208 .inner(py)
212 .borrow_mut() 209 .borrow_mut()
213 .get_non_normal_other_parent_entries().0 210 .get_non_normal_other_parent_entries().0
214 .as_ref() 211 .iter().map(|o| o))
215 .unwrap().iter().map(|o| o))
216 ) 212 )
217 ) 213 )
218 } 214 }
219 215
220 def non_normal_entries_remove(&self, key: PyObject) -> PyResult<PyObject> { 216 def non_normal_entries_remove(&self, key: PyObject) -> PyResult<PyObject> {