# HG changeset patch # User Raphaël Gomès # Date 2022-10-26 16:46:56 # Node ID fc719967efd0be42bc8771baf196035b7b1a1aff # Parent e255a5355971b18c24911aa5aaa74075ee084e09 dirstate-v2: fix edge case where entries aren't sorted See previous commit for more details. diff --git a/mercurial/dirstateutils/v2.py b/mercurial/dirstateutils/v2.py --- a/mercurial/dirstateutils/v2.py +++ b/mercurial/dirstateutils/v2.py @@ -272,7 +272,7 @@ def pack_dirstate(map, copy_map): ) 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 diff --git a/tests/test-dirstate.t b/tests/test-dirstate.t --- a/tests/test-dirstate.t +++ b/tests/test-dirstate.t @@ -257,15 +257,5 @@ Check dirstate ordering $ 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 ..