[PATCH 2 of 2 stable] discovery: indices between sample and yesno must match (issue4438)

Mads Kiilerich mads at kiilerich.com
Wed Nov 5 06:06:51 CST 2014


# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1415189132 -3600
#      Wed Nov 05 13:05:32 2014 +0100
# Branch stable
# Node ID c6c7123f623ca707b4b8382c82178e5eded22c3a
# Parent  2396965a3523fce4059beba5c6c8ff9873000afd
discovery: indices between sample and yesno must match (issue4438)

3ef893520a85 changed 'sample' from a list to a set. The iteration order is thus
undefined and the yesno indices are not stable.

To solve this, repeat the listification and comment from elsewhere in the code.

Note: the randomness in the discovery protocol can make this problem hard to
reproduce.

diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py
--- a/mercurial/setdiscovery.py
+++ b/mercurial/setdiscovery.py
@@ -134,6 +134,8 @@ def findcommonheads(ui, local, remote,
     roundtrips += 1
     ownheads = dag.heads()
     sample = _limitsample(ownheads, initialsamplesize)
+    # indices between sample and externalized version must match
+    sample = list(sample)
     if remote.local():
         # stopgap until we have a proper localpeer that supports batch()
         srvheadhashes = remote.heads()


More information about the Mercurial-devel mailing list