discovery: do not build sample if undecided is smaller than sample size
authorPierre-Yves David <pierre-yves.david@fb.com>
Wed, 07 Jan 2015 15:24:47 -0800
changeset 1193 de73285cf504
parent 1192 a556fff7adcf
child 1195 af9fd422adbb
discovery: do not build sample if undecided is smaller than sample size This prevents crash with coming change in the mercurial discovery.
hgext/evolve.py
--- a/hgext/evolve.py	Mon Jan 05 19:04:32 2015 -0800
+++ b/hgext/evolve.py	Wed Jan 07 15:24:47 2015 -0800
@@ -2390,7 +2390,10 @@
     while undecided:
 
         ui.note(_("sampling from both directions\n"))
-        sample = _takefullsample(dag, undecided, size=fullsamplesize)
+        if len(undecided) < fullsamplesize:
+            sample = set(undecided)
+        else:
+            sample = _takefullsample(dag, undecided, size=fullsamplesize)
 
         roundtrips += 1
         ui.debug("query %i; still undecided: %i, sample size is: %i\n"