Mercurial > hg
comparison mercurial/hbisect.py @ 49441:3ef153aa1eed
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.
author | Arun Kulshreshtha <akulshreshtha@janestreet.com> |
---|---|
date | Tue, 23 Aug 2022 17:31:19 -0400 |
parents | 6000f5b25c9b |
children | c6a1beba27e9 |
comparison
equal
deleted
inserted
replaced
49440:a0b57cabc245 | 49441:3ef153aa1eed |
---|---|
37 skip = {changelog.rev(n) for n in state[b'skip']} | 37 skip = {changelog.rev(n) for n in state[b'skip']} |
38 | 38 |
39 def buildancestors(bad, good): | 39 def buildancestors(bad, good): |
40 badrev = min([changelog.rev(n) for n in bad]) | 40 badrev = min([changelog.rev(n) for n in bad]) |
41 ancestors = collections.defaultdict(lambda: None) | 41 ancestors = collections.defaultdict(lambda: None) |
42 for rev in repo.revs(b"descendants(%ln) - ancestors(%ln)", good, good): | 42 for rev in repo.revs(b"(%ln::%d) - (::%ln)", good, badrev, good): |
43 ancestors[rev] = [] | 43 ancestors[rev] = [] |
44 if ancestors[badrev] is None: | 44 if ancestors[badrev] is None: |
45 return badrev, None | 45 return badrev, None |
46 return badrev, ancestors | 46 return badrev, ancestors |
47 | 47 |