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

login
register
mail settings
Submitter Pierre-Yves David
Date March 5, 2019, 5:39 p.m.
Message ID <d0213fa8b2d4fa5f46f4.1551807552@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/39078/
State Accepted
Headers show

Comments

Pierre-Yves David - March 5, 2019, 5:39 p.m.
# HG changeset patch
# User Georges Racinet <georges.racinet@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.
Yuya Nishihara - March 6, 2019, 8:54 p.m.
On Tue, 05 Mar 2019 18:39:12 +0100, Pierre-Yves David wrote:
> # HG changeset patch
> # User Georges Racinet <georges.racinet@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`

Queued the series, thanks.

Patch

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)