[PATCH 1 of 9 "] discovery: rename `srvheads` to `knownsrvheads`

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Mar 5 17:39:12 UTC 2019


# HG changeset patch
# User Georges Racinet <georges.racinet at octobus.net>
# Date 1551307506 -3600
#      Wed Feb 27 23:45:06 2019 +0100
# Node ID d0213fa8b2d4fa5f46f4efc79f8562faa9dfd2ef
# Parent  2d835c42ab41a6cdcf7c0f2169f82c01b7e249ff
# EXP-Topic discovery-speedup
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r d0213fa8b2d4
discovery: rename `srvheads` to `knownsrvheads`

The `srvheads` variable only constains the known set of remove heads. Renaming
the variable make it clearer.

diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py
--- a/mercurial/setdiscovery.py
+++ b/mercurial/setdiscovery.py
@@ -272,18 +272,18 @@ def findcommonheads(ui, local, remote,
     # compatibility reasons)
     ui.status(_("searching for changes\n"))
 
-    srvheads = []
+    knownsrvheads = []  # revnos of remote heads that are known locally
     for node in srvheadhashes:
         if node == nullid:
             continue
 
         try:
-            srvheads.append(clrev(node))
+            knownsrvheads.append(clrev(node))
         # Catches unknown and filtered nodes.
         except error.LookupError:
             continue
 
-    if len(srvheads) == len(srvheadhashes):
+    if len(knownsrvheads) == len(srvheadhashes):
         ui.debug("all remote heads known locally\n")
         return srvheadhashes, False, srvheadhashes
 
@@ -297,7 +297,7 @@ def findcommonheads(ui, local, remote,
     disco = partialdiscovery(local, ownheads)
     # treat remote heads (and maybe own heads) as a first implicit sample
     # response
-    disco.addcommons(srvheads)
+    disco.addcommons(knownsrvheads)
     disco.addinfo(zip(sample, yesno))
 
     full = False
@@ -340,7 +340,7 @@ def findcommonheads(ui, local, remote,
     ui.debug("%d total queries in %.4fs\n" % (roundtrips, elapsed))
     msg = ('found %d common and %d unknown server heads,'
            ' %d roundtrips in %.4fs\n')
-    missing = set(result) - set(srvheads)
+    missing = set(result) - set(knownsrvheads)
     ui.log('discovery', msg, len(result), len(missing), roundtrips,
            elapsed)
 


More information about the Mercurial-devel mailing list