changeset 24927:cd0068232ec0

obsolete: speed up computation of bumped revset Speed up the computation of the bumped revset by using the not public() revset. In another patch series, we optimized the not public() revset. Together, this cuts the cost of the computation of bumped() from 17% of the total time of smartlog on our big repo to under 0.1% of the total time.
author Laurent Charignon <lcharignon@fb.com>
date Fri, 24 Apr 2015 14:46:30 -0700
parents 3fe1e07f1a32
children 876a2ebfbf4f
files mercurial/obsolete.py
diffstat 1 files changed, 11 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/obsolete.py	Thu Mar 19 13:15:20 2015 -0700
+++ b/mercurial/obsolete.py	Fri Apr 24 14:46:30 2015 -0700
@@ -1139,19 +1139,18 @@
     public = phases.public
     cl = repo.changelog
     torev = cl.nodemap.get
-    obs = getrevs(repo, 'obsolete')
-    for rev in repo:
+    for ctx in repo.set('(not public()) and (not obsolete())'):
+        rev = ctx.rev()
         # We only evaluate mutable, non-obsolete revision
-        if (public < phase(repo, rev)) and (rev not in obs):
-            node = cl.node(rev)
-            # (future) A cache of precursors may worth if split is very common
-            for pnode in allprecursors(repo.obsstore, [node],
-                                       ignoreflags=bumpedfix):
-                prev = torev(pnode) # unfiltered! but so is phasecache
-                if (prev is not None) and (phase(repo, prev) <= public):
-                    # we have a public precursors
-                    bumped.add(rev)
-                    break # Next draft!
+        node = ctx.node()
+        # (future) A cache of precursors may worth if split is very common
+        for pnode in allprecursors(repo.obsstore, [node],
+                                   ignoreflags=bumpedfix):
+            prev = torev(pnode) # unfiltered! but so is phasecache
+            if (prev is not None) and (phase(repo, prev) <= public):
+                # we have a public precursors
+                bumped.add(rev)
+                break # Next draft!
     return bumped
 
 @cachefor('divergent')