# HG changeset patch # User Boris Feld # Date 1546620599 -3600 # Node ID 71b0db4fa0275fd95a3c80571a48706bdc60df86 # Parent 3e1960e23e6b672cd8e61409e3926d91428eb1c7 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 diff -r 3e1960e23e6b -r 71b0db4fa027 mercurial/setdiscovery.py --- 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)