diff rust/hg-cpython/src/dirstate/dirs_multiset.rs @ 47332:4ee9f419c52e

rust: Return owned instead of borrowed DirstateEntry in DirstateMap APIs This will enable the tree-based DirstateMap to not always have an actual DirstateEntry in memory for all nodes, but construct it on demand. Differential Revision: https://phab.mercurial-scm.org/D10746
author Simon Sapin <simon.sapin@octobus.net>
date Wed, 19 May 2021 13:15:00 +0200
parents 776b97179c06
children ed1583a845d2
line wrap: on
line diff
--- a/rust/hg-cpython/src/dirstate/dirs_multiset.rs	Wed May 19 13:15:00 2021 +0200
+++ b/rust/hg-cpython/src/dirstate/dirs_multiset.rs	Wed May 19 13:15:00 2021 +0200
@@ -45,7 +45,8 @@
         }
         let inner = if let Ok(map) = map.cast_as::<PyDict>(py) {
             let dirstate = extract_dirstate(py, &map)?;
-            DirsMultiset::from_dirstate(&dirstate, skip_state)
+            let dirstate = dirstate.iter().map(|(k, v)| (k, *v));
+            DirsMultiset::from_dirstate(dirstate, skip_state)
                 .map_err(|e: DirstateMapError| {
                     PyErr::new::<exc::ValueError, _>(py, e.to_string())
                 })?