merge-slicing: use reachable roots to filter the various branches
Reachable roots does what we want and have a quite fast C implementation.
--- a/hgext3rd/evolve/stablerange.py Fri Mar 24 05:51:20 2017 +0100
+++ b/hgext3rd/evolve/stablerange.py Fri Mar 24 06:36:12 2017 +0100
@@ -428,11 +428,17 @@
parentrevs = cl.parentrevs
parents = self._parents
du = bheads.difference_update
+ reachableroots = repo.changelog.reachableroots
for r in bottomrevs:
du(parents(r, parentrevs))
for h in bheads:
- subset = cl.ancestors([h], inclusive=True)
- hrevs = [r for r in bottomrevs if r in subset]
+ # reachable roots is fast because is C
+ #
+ # It is worth noting that will use this kind of filtering from
+ # "h" multiple time in a warming run. So using "ancestors" and
+ # caching that should be faster. But python code filtering on
+ # the ancestors end up being slower.
+ hrevs = reachableroots(bottomrevs[0], [h], bottomrevs, True)
start = self.depthrev(repo, h) - len(hrevs)
entry = (h, start)
result.append(entry)