bisect: limit ancestors to revs topologically between good and bad revs
authorArun Kulshreshtha <akulshreshtha@janestreet.com>
Tue, 23 Aug 2022 17:31:19 -0400
changeset 49441 3ef153aa1eed
parent 49440 a0b57cabc245
child 49442 816236523765
bisect: limit ancestors to revs topologically between good and bad revs Previously, when constructing its dict of revisions to their ancestors, bisect would populate the dict with ALL of the descendents of the good set, which is a bit silly because it is impossible for a revision that is a descendent of the minimum known bad revision to be the first bad rev. Instead it makes more sense to limit the revisions to just those topologically between the good and bad.
mercurial/hbisect.py
--- a/mercurial/hbisect.py	Tue Aug 23 17:31:13 2022 -0400
+++ b/mercurial/hbisect.py	Tue Aug 23 17:31:19 2022 -0400
@@ -39,7 +39,7 @@
     def buildancestors(bad, good):
         badrev = min([changelog.rev(n) for n in bad])
         ancestors = collections.defaultdict(lambda: None)
-        for rev in repo.revs(b"descendants(%ln) - ancestors(%ln)", good, good):
+        for rev in repo.revs(b"(%ln::%d) - (::%ln)", good, badrev, good):
             ancestors[rev] = []
         if ancestors[badrev] is None:
             return badrev, None