# HG changeset patch # User Matt Mackall # Date 1199146833 21600 # Node ID 49809f4a38d88abef6602fbbec6ae5e0f7ce664f # Parent 78d14403bdc7ccf015a723fc90df1681a32b2ce7 bisect: calculate candidate set while finding children diff -r 78d14403bdc7 -r 49809f4a38d8 hgext/hbisect.py --- a/hgext/hbisect.py Mon Dec 31 18:20:33 2007 -0600 +++ b/hgext/hbisect.py Mon Dec 31 18:20:33 2007 -0600 @@ -34,9 +34,11 @@ # build children dict children = {} visit = [badrev] + candidates = [] while visit: rev = visit.pop(0) if ancestors[rev] == []: + candidates.append(rev) for prev in clparents(rev): if prev != -1: if prev in children: @@ -45,8 +47,10 @@ children[prev] = [rev] visit.append(prev) + candidates.sort() + # accumulate ancestor lists - for rev in xrange(badrev + 1): + for rev in candidates: l = ancestors[rev] if l != None: if not l: @@ -66,7 +70,6 @@ ancestors[c] = [a] ancestors[rev] = len(a) - candidates = a # ancestors of badrev, last rev visited del children if badrev not in candidates: