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
--- 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)