changeset 2216:de76219b42b8

merge-slicing: use reachable roots to filter the various branches Reachable roots does what we want and have a quite fast C implementation.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Fri, 24 Mar 2017 06:36:12 +0100
parents 6d9cadc635d5
children 37fa3d83f294
files hgext3rd/evolve/stablerange.py
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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)