# HG changeset patch # User Pierre-Yves David # Date 1490333772 -3600 # Node ID de76219b42b86149a4b8284292b9ccb33581d942 # Parent 6d9cadc635d54f942444a6d9e3b0460a656d822a merge-slicing: use reachable roots to filter the various branches Reachable roots does what we want and have a quite fast C implementation. diff -r 6d9cadc635d5 -r de76219b42b8 hgext3rd/evolve/stablerange.py --- 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)