Patchwork D2646: setdiscovery: avoid a Yoda condition

login
register
mail settings
Submitter phabricator
Date March 4, 2018, 4:58 p.m.
Message ID <differential-rev-PHID-DREV-el72r3ss7twakds3y4vz-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/28934/
State Superseded
Headers show

Comments

phabricator - March 4, 2018, 4:58 p.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/setdiscovery.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
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