wireproto: sort response to listkeys
authorGregory Szorc <gregory.szorc@gmail.com>
Fri, 23 Feb 2018 09:40:12 -0800
changeset 36558 33c6f8f0388d
parent 36557 72e487851a53
child 36559 bde0bd50f368
wireproto: sort response to listkeys The listkeys protocol is defined to produce a dictionary. pushkey.decodekeys() uses a plain dict to hold the decoded results of the wire protocol response. So order should not matter. Upcoming tests will verify low-level output of wire protocol commands and the non-deterministic emitting of listkeys was causing intermittent failures. So we make the output of listkeys deterministic. Differential Revision: https://phab.mercurial-scm.org/D2405
mercurial/wireproto.py
--- a/mercurial/wireproto.py	Thu Mar 01 08:24:54 2018 -0800
+++ b/mercurial/wireproto.py	Fri Feb 23 09:40:12 2018 -0800
@@ -916,7 +916,7 @@
 
 @wireprotocommand('listkeys', 'namespace')
 def listkeys(repo, proto, namespace):
-    d = repo.listkeys(encoding.tolocal(namespace)).items()
+    d = sorted(repo.listkeys(encoding.tolocal(namespace)).items())
     return bytesresponse(pushkeymod.encodekeys(d))
 
 @wireprotocommand('lookup', 'key')