obsolete: drop usage of changectx in '_computephasedivergentset'
authorBoris Feld <boris.feld@octobus.net>
Sun, 19 Nov 2017 05:23:12 +0100
changeset 35136 82680919d75e
parent 35135 e46f0b653002
child 35137 5cd6682b5a90
obsolete: drop usage of changectx in '_computephasedivergentset' Changectx are expensive and not needed there. The use of `repo.set` denote old code that predate the introduction of `repo.revs` that we now use. On my mercurial repository 495 draft: before: 0.010275 second after: 0.008832 second On a mercurial repository with 115973 draft: before: 0.899255 second after: 0.397131 second
mercurial/obsolete.py
--- a/mercurial/obsolete.py	Sat Nov 25 16:01:27 2017 +0800
+++ b/mercurial/obsolete.py	Sun Nov 19 05:23:12 2017 +0100
@@ -994,10 +994,10 @@
     public = phases.public
     cl = repo.changelog
     torev = cl.nodemap.get
-    for ctx in repo.set('(not public()) and (not obsolete())'):
-        rev = ctx.rev()
+    tonode = cl.node
+    for rev in repo.revs('(not public()) and (not obsolete())'):
         # We only evaluate mutable, non-obsolete revision
-        node = ctx.node()
+        node = tonode(rev)
         # (future) A cache of predecessors may worth if split is very common
         for pnode in obsutil.allpredecessors(repo.obsstore, [node],
                                    ignoreflags=bumpedfix):