Mercurial > hg
comparison rust/hg-cpython/src/dirstate/dirstate_map.rs @ 49120:3df46f3a3d6c
rust-dirstatemap: implement part of the `setparents` logic
The Python code does many round-trip calls to the Rust dirstatemap when copy
information needs to be dropped in `setparents`.
This may result in improved performance on `commit`, `update` and other such
commands, but was mostly done to drop the last use of `set_dirstate_item`.
See inline comments for an asterisk about performance, and see next patch for
why `set_dirstate_item` has to go.
Differential Revision: https://phab.mercurial-scm.org/D12518
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Tue, 29 Mar 2022 00:53:11 +0200 |
parents | a55934393078 |
children | 10edc54d18f1 |
comparison
equal
deleted
inserted
replaced
49119:4c75f00b199e | 49120:3df46f3a3d6c |
---|---|
487 dirs.append(py, path.into_object()) | 487 dirs.append(py, path.into_object()) |
488 } | 488 } |
489 Ok(dirs) | 489 Ok(dirs) |
490 } | 490 } |
491 | 491 |
492 def setparents_fixup(&self) -> PyResult<PyDict> { | |
493 let dict = PyDict::new(py); | |
494 let copies = self.inner(py).borrow_mut().setparents_fixup(); | |
495 for (key, value) in copies.map_err(|e| v2_error(py, e))? { | |
496 dict.set_item( | |
497 py, | |
498 PyBytes::new(py, key.as_bytes()), | |
499 PyBytes::new(py, value.as_bytes()), | |
500 )?; | |
501 } | |
502 Ok(dict) | |
503 } | |
504 | |
492 def debug_iter(&self, all: bool) -> PyResult<PyList> { | 505 def debug_iter(&self, all: bool) -> PyResult<PyList> { |
493 let dirs = PyList::new(py, &[]); | 506 let dirs = PyList::new(py, &[]); |
494 for item in self.inner(py).borrow().debug_iter(all) { | 507 for item in self.inner(py).borrow().debug_iter(all) { |
495 let (path, (state, mode, size, mtime)) = | 508 let (path, (state, mode, size, mtime)) = |
496 item.map_err(|e| v2_error(py, e))?; | 509 item.map_err(|e| v2_error(py, e))?; |