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