danchr created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9671

AFFECTED FILES
  rust/hg-core/src/dirstate/dirstate_map.rs
  rust/hg-cpython/src/dirstate/dirstate_map.rs

CHANGE DETAILS

diff --git a/rust/hg-cpython/src/dirstate/dirstate_map.rs 
b/rust/hg-cpython/src/dirstate/dirstate_map.rs
--- a/rust/hg-cpython/src/dirstate/dirstate_map.rs
+++ b/rust/hg-cpython/src/dirstate/dirstate_map.rs
@@ -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)
diff --git a/rust/hg-core/src/dirstate/dirstate_map.rs 
b/rust/hg-core/src/dirstate/dirstate_map.rs
--- a/rust/hg-core/src/dirstate/dirstate_map.rs
+++ b/rust/hg-core/src/dirstate/dirstate_map.rs
@@ -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());
             }



To: danchr, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to