Patchwork D2405: wireproto: sort response to listkeys

login
register
mail settings
Submitter phabricator
Date Feb. 23, 2018, 7:01 p.m.
Message ID <differential-rev-PHID-DREV-c7avxzskve6rqdrc4igy-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/28293/
State Superseded
Headers show

Comments

phabricator - Feb. 23, 2018, 7:01 p.m.
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




To: indygreg, #hg-reviewers
Cc: mercurial-devel
phabricator - March 1, 2018, 9:36 p.m.
durin42 added a comment.


  I'm a little bummed about this because namespaces could be *enormous*, like bookmarks. We might want to find another way to handle this...

REPOSITORY
  rHG Mercurial

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

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

Patch

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')