Mercurial > evolve
comparison hgext3rd/topic/revset.py @ 2650:db788700ed82
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)
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 22 Jun 2017 09:46:30 +0200 |
parents | 042356d5ba59 |
children | 6a3df2404472 |
comparison
equal
deleted
inserted
replaced
2649:cf930521f14d | 2650:db788700ed82 |
---|---|
1 from __future__ import absolute_import | 1 from __future__ import absolute_import |
2 | 2 |
3 from mercurial.i18n import _ | 3 from mercurial.i18n import _ |
4 from mercurial import ( | 4 from mercurial import ( |
5 error, | 5 error, |
6 phases, | |
6 revset, | 7 revset, |
7 util, | 8 util, |
8 ) | 9 ) |
9 | 10 |
10 from . import ( | 11 from . import ( |
35 if topic == '.': | 36 if topic == '.': |
36 topic = repo['.'].extra().get('topic', '') | 37 topic = repo['.'].extra().get('topic', '') |
37 _kind, _pattern, matcher = mkmatcher(topic) | 38 _kind, _pattern, matcher = mkmatcher(topic) |
38 else: | 39 else: |
39 matcher = lambda t: bool(t) | 40 matcher = lambda t: bool(t) |
40 drafts = subset.filter(lambda r: repo[r].mutable()) | 41 mutable = repo._phasecache.getrevset(repo, (phases.draft, phases.secret)) |
42 drafts = subset & mutable | |
41 return drafts.filter( | 43 return drafts.filter( |
42 lambda r: matcher(repo[r].extra().get(constants.extrakey, ''))) | 44 lambda r: matcher(repo[r].extra().get(constants.extrakey, ''))) |
43 | 45 |
44 def ngtipset(repo, subset, x): | 46 def ngtipset(repo, subset, x): |
45 """`ngtip([branch])` | 47 """`ngtip([branch])` |