Mercurial > hg
comparison mercurial/repoview.py @ 38156:5b592ac502ef
repoview: use 'phasecache.getrevset' when computing 'unserved' filter
This reuses a precomputed set, being much faster than manual iteration.
Computing the "unserved" filter speed up by 55%.
before: wall 0.014671 comb 0.020000 user 0.020000 sys 0.000000 (best of 180)
after: wall 0.006623 comb 0.010000 user 0.010000 sys 0.000000 (best of 401)
The "unserved" filter is used to restrict the revisions client can pull from a
server. (eg: secret changesets)
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Mon, 21 May 2018 17:33:50 +0200 |
parents | 07fdac1d5c66 |
children | 02f992ac26e9 |
comparison
equal
deleted
inserted
replaced
38155:5736570718fe | 38156:5b592ac502ef |
---|---|
90 Secret and hidden changeset should not pretend to be here.""" | 90 Secret and hidden changeset should not pretend to be here.""" |
91 assert not repo.changelog.filteredrevs | 91 assert not repo.changelog.filteredrevs |
92 # fast path in simple case to avoid impact of non optimised code | 92 # fast path in simple case to avoid impact of non optimised code |
93 hiddens = filterrevs(repo, 'visible') | 93 hiddens = filterrevs(repo, 'visible') |
94 if phases.hassecret(repo): | 94 if phases.hassecret(repo): |
95 cl = repo.changelog | 95 secrets = frozenset(repo._phasecache.getrevset(repo, (phases.secret,))) |
96 secret = phases.secret | |
97 getphase = repo._phasecache.phase | |
98 first = min(cl.rev(n) for n in repo._phasecache.phaseroots[secret]) | |
99 revs = cl.revs(start=first) | |
100 secrets = set(r for r in revs if getphase(repo, r) >= secret) | |
101 return frozenset(hiddens | secrets) | 96 return frozenset(hiddens | secrets) |
102 else: | 97 else: |
103 return hiddens | 98 return hiddens |
104 | 99 |
105 def computemutable(repo, visibilityexceptions=None): | 100 def computemutable(repo, visibilityexceptions=None): |