Mercurial > evolve
changeset 2651:6a3df2404472
topic-revset: update the revset to no longer build changectx
Atribute access is expensive, and changectx are very expensive to build, so we
skip these for better performance.
Before:
! wall 0.012195 comb 0.020000 user 0.020000 sys 0.000000 (best of 217)
After:
! wall 0.008816 comb 0.010000 user 0.010000 sys 0.000000 (best of 303)
(Before this changeset parent)
! wall 0.213261 comb 0.210000 user 0.210000 sys 0.000000 (best of 45)
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 22 Jun 2017 09:41:01 +0200 |
parents | db788700ed82 |
children | 839c2879edcc |
files | hgext3rd/topic/revset.py |
diffstat | 1 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/topic/revset.py Thu Jun 22 09:46:30 2017 +0200 +++ b/hgext3rd/topic/revset.py Thu Jun 22 09:41:01 2017 +0200 @@ -39,9 +39,16 @@ else: matcher = lambda t: bool(t) mutable = repo._phasecache.getrevset(repo, (phases.draft, phases.secret)) - drafts = subset & mutable - return drafts.filter( - lambda r: matcher(repo[r].extra().get(constants.extrakey, ''))) + + rawchange = repo.changelog.changelogrevision + key = constants.extrakey + + def matchtopic(r): + topic = rawchange(r).extra.get(key) + if topic is None: + return False + return matcher(topic) + return (subset & mutable).filter(matchtopic) def ngtipset(repo, subset, x): """`ngtip([branch])`