mutation: remove exponential algorithm from obsoletenodes

Summary:
Computing all successorsets is exponential with the number of splits
that have happened. This can slow things down tremendously.

The obsoletenodes path only needs to know "is there a visible successor" in
order to determine if a draft commit is obsolete. Let's use allsuccessors
instead of successorset.

Reviewed By: quark-zju

Differential Revision: D23771025

fbshipit-source-id: 666875e681c2e3306fc301357c95f1ab5bb40a87
This commit is contained in:
Durham Goode 2020-09-17 18:28:12 -07:00 committed by Facebook GitHub Bot
parent 923bac59b2
commit 41b0cf71e8

View File

@ -315,10 +315,11 @@ class obsoletecache(object):
clrev = repo.changelog.rev
obsolete = self.obsolete[None]
for node in repo.nodes("not public()"):
succsets = successorssets(repo, node, closest=True)
if succsets != [[node]]:
if any(clhasnode(succ) for succset in succsets for succ in succset):
obsolete.add(node)
if any(
clhasnode(succ)
for succ in allsuccessors(repo, [node], startdepth=1)
):
obsolete.add(node)
candidates = set(obsolete)
seen = set(obsolete)
while candidates: