Mercurial > hg
comparison mercurial/repoview.py @ 32426:06aa645e2372
repoview: move '_getdynamicblock' next to 'hideablerevs'
There are the two functions that extensions should use to augment the hidding
logic. It seem better to have them together at the top of the file.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sat, 20 May 2017 19:43:29 +0200 |
parents | 55390e97fdd2 |
children | 8db2feb04ceb |
comparison
equal
deleted
inserted
replaced
32425:397e3a2e9347 | 32426:06aa645e2372 |
---|---|
29 Because we use the set of immutable changesets as a fallback subset in | 29 Because we use the set of immutable changesets as a fallback subset in |
30 branchmap (see mercurial.branchmap.subsettable), you cannot set "public" | 30 branchmap (see mercurial.branchmap.subsettable), you cannot set "public" |
31 changesets as "hideable". Doing so would break multiple code assertions and | 31 changesets as "hideable". Doing so would break multiple code assertions and |
32 lead to crashes.""" | 32 lead to crashes.""" |
33 return obsolete.getrevs(repo, 'obsolete') | 33 return obsolete.getrevs(repo, 'obsolete') |
34 | |
35 def _getdynamicblockers(repo): | |
36 """Non-cacheable revisions blocking hidden changesets from being filtered. | |
37 | |
38 Get revisions that will block hidden changesets and are likely to change, | |
39 but unlikely to create hidden blockers. They won't be cached, so be careful | |
40 with adding additional computation.""" | |
41 | |
42 cl = repo.changelog | |
43 blockers = set() | |
44 blockers.update([par.rev() for par in repo[None].parents()]) | |
45 blockers.update([cl.rev(bm) for bm in repo._bookmarks.values()]) | |
46 | |
47 tags = {} | |
48 tagsmod.readlocaltags(repo.ui, repo, tags, {}) | |
49 if tags: | |
50 rev, nodemap = cl.rev, cl.nodemap | |
51 blockers.update(rev(t[0]) for t in tags.values() if t[0] in nodemap) | |
52 return blockers | |
34 | 53 |
35 def _getstatichidden(repo): | 54 def _getstatichidden(repo): |
36 """Revision to be hidden (disregarding dynamic blocker) | 55 """Revision to be hidden (disregarding dynamic blocker) |
37 | 56 |
38 To keep a consistent graph, we cannot hide any revisions with | 57 To keep a consistent graph, we cannot hide any revisions with |
71 seen.add(parent) | 90 seen.add(parent) |
72 if pre < len(seen) and getphase(repo, rev): | 91 if pre < len(seen) and getphase(repo, rev): |
73 heappush(heap, -parent) | 92 heappush(heap, -parent) |
74 return hidden | 93 return hidden |
75 | 94 |
76 def _getdynamicblockers(repo): | |
77 """Non-cacheable revisions blocking hidden changesets from being filtered. | |
78 | |
79 Get revisions that will block hidden changesets and are likely to change, | |
80 but unlikely to create hidden blockers. They won't be cached, so be careful | |
81 with adding additional computation.""" | |
82 | |
83 cl = repo.changelog | |
84 blockers = set() | |
85 blockers.update([par.rev() for par in repo[None].parents()]) | |
86 blockers.update([cl.rev(bm) for bm in repo._bookmarks.values()]) | |
87 | |
88 tags = {} | |
89 tagsmod.readlocaltags(repo.ui, repo, tags, {}) | |
90 if tags: | |
91 rev, nodemap = cl.rev, cl.nodemap | |
92 blockers.update(rev(t[0]) for t in tags.values() if t[0] in nodemap) | |
93 return blockers | |
94 | |
95 cacheversion = 1 | 95 cacheversion = 1 |
96 cachefile = 'cache/hidden' | 96 cachefile = 'cache/hidden' |
97 | 97 |
98 def cachehash(repo, hideable): | 98 def cachehash(repo, hideable): |
99 """return sha1 hash of repository data to identify a valid cache. | 99 """return sha1 hash of repository data to identify a valid cache. |