comparison hgext/evolve.py @ 1193:de73285cf504

discovery: do not build sample if undecided is smaller than sample size This prevents crash with coming change in the mercurial discovery.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 07 Jan 2015 15:24:47 -0800
parents a556fff7adcf
children 9e3f332f7630
comparison
equal deleted inserted replaced
1192:a556fff7adcf 1193:de73285cf504
2388 _takefullsample = setdiscovery._takefullsample 2388 _takefullsample = setdiscovery._takefullsample
2389 2389
2390 while undecided: 2390 while undecided:
2391 2391
2392 ui.note(_("sampling from both directions\n")) 2392 ui.note(_("sampling from both directions\n"))
2393 sample = _takefullsample(dag, undecided, size=fullsamplesize) 2393 if len(undecided) < fullsamplesize:
2394 sample = set(undecided)
2395 else:
2396 sample = _takefullsample(dag, undecided, size=fullsamplesize)
2394 2397
2395 roundtrips += 1 2398 roundtrips += 1
2396 ui.debug("query %i; still undecided: %i, sample size is: %i\n" 2399 ui.debug("query %i; still undecided: %i, sample size is: %i\n"
2397 % (roundtrips, len(undecided), len(sample))) 2400 % (roundtrips, len(undecided), len(sample)))
2398 # indices between sample and externalized version must match 2401 # indices between sample and externalized version must match