topic-revset: changectx creation in the revset
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 22 Jun 2017 09:46:30 +0200
changeset 2650 db788700ed82
parent 2649 cf930521f14d
child 2651 6a3df2404472
topic-revset: changectx creation in the revset The current mutability filter is very expensive, we use a more direct and efficent way to do so: Before: ! wall 0.213261 comb 0.210000 user 0.210000 sys 0.000000 (best of 45) After: ! wall 0.012195 comb 0.020000 user 0.020000 sys 0.000000 (best of 217)
hgext3rd/topic/revset.py
--- a/hgext3rd/topic/revset.py	Wed Jun 21 07:32:11 2017 +0530
+++ b/hgext3rd/topic/revset.py	Thu Jun 22 09:46:30 2017 +0200
@@ -3,6 +3,7 @@
 from mercurial.i18n import _
 from mercurial import (
     error,
+    phases,
     revset,
     util,
 )
@@ -37,7 +38,8 @@
         _kind, _pattern, matcher = mkmatcher(topic)
     else:
         matcher = lambda t: bool(t)
-    drafts = subset.filter(lambda r: repo[r].mutable())
+    mutable = repo._phasecache.getrevset(repo, (phases.draft, phases.secret))
+    drafts = subset & mutable
     return drafts.filter(
         lambda r: matcher(repo[r].extra().get(constants.extrakey, '')))