changeset 5769:49809f4a38d8

bisect: calculate candidate set while finding children
author Matt Mackall <mpm@selenic.com>
date Mon, 31 Dec 2007 18:20:33 -0600
parents 78d14403bdc7
children f5b858fc8067
files hgext/hbisect.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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: