[PATCH 2 of 6] phases: emit phases to pushkey protocol in deterministic order
Gregory Szorc
gregory.szorc at gmail.com
Fri Apr 14 03:44:06 EDT 2017
# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1492146724 25200
# Thu Apr 13 22:12:04 2017 -0700
# Node ID 283a95fe4ce5b91af4e2ed8ed1d3fe18ef3544bb
# Parent c56b03b176c65a460e282956827f5f8ab6890283
phases: emit phases to pushkey protocol in deterministic order
An upcoming test will report exact bytes sent over the wire protocol.
Without this change, the ordering of phases listkey data is
non-deterministic.
diff --git a/mercurial/phases.py b/mercurial/phases.py
--- a/mercurial/phases.py
+++ b/mercurial/phases.py
@@ -116,6 +116,7 @@ from . import (
error,
smartset,
txnutil,
+ util,
)
allphases = public, draft, secret = range(3)
@@ -386,7 +387,8 @@ def retractboundary(repo, tr, targetphas
def listphases(repo):
"""List phases root for serialization over pushkey"""
- keys = {}
+ # Use ordered dictionary so behavior is deterministic.
+ keys = util.sortdict()
value = '%i' % draft
for root in repo._phasecache.phaseroots[draft]:
keys[hex(root)] = value
More information about the Mercurial-devel
mailing list