D1498: hbisect: use a revset for ancestor calculation

dsp (David Soria Parra) phabricator at mercurial-scm.org
Fri Nov 24 23:30:32 EST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rHGec25c8275cfa: hbisect: use a revset for ancestor calculation (authored by dsp, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1498?vs=3804&id=3857

REVISION DETAIL
  https://phab.mercurial-scm.org/D1498

AFFECTED FILES
  mercurial/hbisect.py

CHANGE DETAILS

diff --git a/mercurial/hbisect.py b/mercurial/hbisect.py
--- a/mercurial/hbisect.py
+++ b/mercurial/hbisect.py
@@ -37,29 +37,10 @@
     skip = set([changelog.rev(n) for n in state['skip']])
 
     def buildancestors(bad, good):
-        # only the earliest bad revision matters
         badrev = min([changelog.rev(n) for n in bad])
-        goodrevs = [changelog.rev(n) for n in good]
-        goodrev = min(goodrevs)
-        # build visit array
-        ancestors = [None] * (len(changelog) + 1) # an extra for [-1]
-
-        # set nodes descended from goodrevs
-        for rev in goodrevs:
+        ancestors = [None] * (len(changelog) + 1)
+        for rev in repo.revs("descendants(%ln) - ancestors(%ln)", good, good):
             ancestors[rev] = []
-        for rev in changelog.revs(goodrev + 1):
-            for prev in clparents(rev):
-                if ancestors[prev] == []:
-                    ancestors[rev] = []
-
-        # clear good revs from array
-        for rev in goodrevs:
-            ancestors[rev] = None
-        for rev in changelog.revs(len(changelog), goodrev):
-            if ancestors[rev] is None:
-                for prev in clparents(rev):
-                    ancestors[prev] = None
-
         if ancestors[badrev] is None:
             return badrev, None
         return badrev, ancestors



To: dsp, #hg-reviewers, yuja
Cc: mercurial-devel


More information about the Mercurial-devel mailing list