diff rust/hg-cpython/src/dirstate.rs @ 42748:7cae6bc29ff9

rust-parsers: switch to parse/pack_dirstate to mutate-on-loop Both `parse_dirstate` and `pack_dirstate` can operate directly on the data they're passed, which prevents the creation of intermediate data structures, simplifies the function signatures and reduces boilerplate. They are exposed directly to the Python for now, but a later patch will make use of them inside `hg-core`. Differential Revision: https://phab.mercurial-scm.org/D6628
author Raphaël Gomès <rgomes@octobus.net>
date Tue, 09 Jul 2019 11:49:49 +0200
parents 760a7851e9ba
children 7ceded4419a3
line wrap: on
line diff
--- a/rust/hg-cpython/src/dirstate.rs	Wed Jul 10 10:16:28 2019 +0200
+++ b/rust/hg-cpython/src/dirstate.rs	Tue Jul 09 11:49:49 2019 +0200
@@ -14,7 +14,7 @@
 use cpython::{
     PyBytes, PyDict, PyErr, PyModule, PyObject, PyResult, PySequence, Python,
 };
-use hg::{DirstateEntry, DirstateVec};
+use hg::{DirstateEntry, StateMap};
 use libc::{c_char, c_int};
 #[cfg(feature = "python27")]
 use python27_sys::PyCapsule_Import;
@@ -54,10 +54,7 @@
     }
 }
 
-pub fn extract_dirstate_vec(
-    py: Python,
-    dmap: &PyDict,
-) -> Result<DirstateVec, PyErr> {
+pub fn extract_dirstate(py: Python, dmap: &PyDict) -> Result<StateMap, PyErr> {
     dmap.items(py)
         .iter()
         .map(|(filename, stats)| {