# HG changeset patch # User Dan Villiom Podlaski Christiansen # Date 1609283668 -3600 # Node ID 5bae4bc9bd428a6e0542e4e2025f6ade7522aec4 # Parent 0826d684a1b596f8768e049b0ae4c04007d292a0 rust: fix file folding map The file folding map, frequently used on macOS, had two issues: * the means for converting it to Python didn't work * a minor typo when copying the python code, where `!=` became `==` With this, the rust code passes all tests on macOS. Test Plan: I'm currently doing a full test run on a case-insensitive file system. If it passes, perhaps we can change the platform check from an error to a warning? Differential Revision: https://phab.mercurial-scm.org/D9671 diff -r 0826d684a1b5 -r 5bae4bc9bd42 rust/hg-core/src/dirstate/dirstate_map.rs --- a/rust/hg-core/src/dirstate/dirstate_map.rs Tue Jan 12 22:43:55 2021 +0100 +++ b/rust/hg-core/src/dirstate/dirstate_map.rs Wed Dec 30 00:14:28 2020 +0100 @@ -431,7 +431,7 @@ let mut new_file_fold_map = FileFoldMap::default(); for (filename, DirstateEntry { state, .. }) in self.state_map.iter() { - if *state == EntryState::Removed { + if *state != EntryState::Removed { new_file_fold_map .insert(normalize_case(&filename), filename.to_owned()); } @@ -447,7 +447,7 @@ let mut new_file_fold_map = FileFoldMap::default(); for (filename, DirstateEntry { state, .. }) in self.state_map.iter() { - if state == EntryState::Removed { + if state != EntryState::Removed { new_file_fold_map .insert(normalize_case(&filename), filename.to_owned()); } diff -r 0826d684a1b5 -r 5bae4bc9bd42 rust/hg-cpython/src/dirstate/dirstate_map.rs --- a/rust/hg-cpython/src/dirstate/dirstate_map.rs Tue Jan 12 22:43:55 2021 +0100 +++ b/rust/hg-cpython/src/dirstate/dirstate_map.rs Wed Dec 30 00:14:28 2020 +0100 @@ -350,8 +350,8 @@ { dict.set_item( py, - key.as_bytes().to_vec(), - value.as_bytes().to_vec(), + PyBytes::new(py, key.as_bytes()).into_object(), + PyBytes::new(py, value.as_bytes()).into_object(), )?; } Ok(dict)