changeset 36718:59802fa590db

setdiscovery: avoid a Yoda condition Differential Revision: https://phab.mercurial-scm.org/D2646
author Martin von Zweigbergk <martinvonz@google.com>
date Sun, 04 Mar 2018 07:40:21 -0800
parents 0968e400406c
children 390d16ea7c76
files mercurial/setdiscovery.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/setdiscovery.py	Sun Mar 04 07:40:11 2018 -0800
+++ b/mercurial/setdiscovery.py	Sun Mar 04 07:40:21 2018 -0800
@@ -106,7 +106,7 @@
     :nodes: set of nodes to discover
     :size: the maximum size of the sample"""
     sample = dag.headsetofconnecteds(nodes)
-    if size <= len(sample):
+    if len(sample) >= size:
         return _limitsample(sample, size)
     _updatesample(dag, None, sample, quicksamplesize=size)
     return sample