[PATCH 1 of 2 stable] discovery: limit 'all local heads known remotely' to real 'all' (issue4438)

Mads Kiilerich mads at kiilerich.com
Wed Nov 5 12:06:50 UTC 2014


# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1415189129 -3600
#      Wed Nov 05 13:05:29 2014 +0100
# Branch stable
# Node ID 2396965a3523fce4059beba5c6c8ff9873000afd
# Parent  a3c2d92112948b2fa1ac3881920ac4d932cda6c8
discovery: limit 'all local heads known remotely' to real 'all' (issue4438)

3ef893520a85 made it possible that the initial head check didn't include all
heads. If that is the case, don't use the early exit just because this random
sample happened to be 'all known'.

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
@@ -165,7 +165,7 @@ def findcommonheads(ui, local, remote,
         ui.debug("all remote heads known locally\n")
         return (srvheadhashes, False, srvheadhashes,)
 
-    if sample and util.all(yesno):
+    if sample and len(ownheads) <= initialsamplesize and util.all(yesno):
         ui.note(_("all local heads known remotely\n"))
         ownheadhashes = dag.externalizeall(ownheads)
         return (ownheadhashes, True, srvheadhashes,)


More information about the Mercurial-devel mailing list