D2646: setdiscovery: avoid a Yoda condition

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Sun Mar 4 14:29:23 EST 2018


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

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



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


More information about the Mercurial-devel mailing list