dirstate-v2: fix edge case where entries aren't sorted stable
authorRaphaël Gomès <rgomes@octobus.net>
Wed, 26 Oct 2022 18:46:56 +0200
branchstable
changeset 49542 fc719967efd0
parent 49541 e255a5355971
child 49543 5f22c92dcf3d
dirstate-v2: fix edge case where entries aren't sorted See previous commit for more details.
mercurial/dirstateutils/v2.py
tests/test-dirstate.t
--- a/mercurial/dirstateutils/v2.py	Wed Oct 26 18:24:34 2022 +0200
+++ b/mercurial/dirstateutils/v2.py	Wed Oct 26 18:46:56 2022 +0200
@@ -272,7 +272,7 @@
         )
         return data, tree_metadata
 
-    sorted_map = sorted(map.items(), key=lambda x: x[0])
+    sorted_map = sorted(map.items(), key=lambda x: x[0].split(b"/"))
 
     # Use a stack to have to only remember the nodes we currently need
     # instead of building the entire tree in memory
--- a/tests/test-dirstate.t	Wed Oct 26 18:24:34 2022 +0200
+++ b/tests/test-dirstate.t	Wed Oct 26 18:46:56 2022 +0200
@@ -257,15 +257,5 @@
   $ touch src/dirstate/file1 src/dirstate/file2 src/dirstate.rs
   $ touch file1 file2
   $ hg commit -Aqm1
-#if rhg no-rust dirstate-v2
   $ hg st
-  ! src/dirstate/file1 (known-bad-output !)
-  ! src/dirstate/file2 (known-bad-output !)
-  ? src/dirstate/file1 (known-bad-output !)
-  ? src/dirstate/file2 (known-bad-output !)
-  expected a value, found none (known-bad-output !)
-  [255]
-#else
-  $ hg st
-#endif
   $ cd ..