changeset 41110:71b0db4fa027

discovery: minor fix to some conditionals Since `size` is the upper limit of the sample, we should include it in the check. Otherwize the `more` variable will be zero and the sampling will be useless
author Boris Feld <boris.feld@octobus.net>
date Fri, 04 Jan 2019 17:49:59 +0100
parents 3e1960e23e6b
children 3c85a62d7462
files mercurial/setdiscovery.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/setdiscovery.py	Thu Dec 20 10:16:24 2018 +0100
+++ b/mercurial/setdiscovery.py	Fri Jan 04 17:49:59 2019 +0100
@@ -146,7 +146,7 @@
     _updatesample(revs, revsroots, sample, children.__getitem__)
     assert sample
     sample = _limitsample(sample, size)
-    if len(sample) < size:
+    if len(sample) <= size:
         more = size - len(sample)
         sample.update(random.sample(list(revs - sample), more))
     return sample
@@ -264,7 +264,7 @@
             ui.debug("taking quick initial sample\n")
             samplefunc = _takequicksample
             targetsize = initialsamplesize
-        if len(undecided) < targetsize:
+        if len(undecided) <= targetsize:
             sample = list(undecided)
         else:
             sample = samplefunc(local, ownheads, undecided, targetsize)