Patchwork D2646: setdiscovery: avoid a Yoda condition

login
register
mail settings
Submitter phabricator
Date March 4, 2018, 7:29 p.m.
Message ID <3f072dfd7d01cfe4b62880b80288522c@localhost.localdomain>
Download mbox | patch
Permalink /patch/28973/
State Not Applicable
Headers show

Comments

phabricator - March 4, 2018, 7:29 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG59802fa590db: setdiscovery: avoid a Yoda condition (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2646?vs=6558&id=6596

REVISION DETAIL
  https://phab.mercurial-scm.org/D2646

AFFECTED FILES
  mercurial/setdiscovery.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers, indygreg
Cc: mercurial-devel

Patch

diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py
--- a/mercurial/setdiscovery.py
+++ b/mercurial/setdiscovery.py
@@ -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