D2405: wireproto: sort response to listkeys

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Fri Feb 23 19:01:43 UTC 2018


indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

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

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/wireproto.py

CHANGE DETAILS

diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
--- a/mercurial/wireproto.py
+++ b/mercurial/wireproto.py
@@ -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')



To: indygreg, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list