Mercurial > hg
diff mercurial/repoview.py @ 18246:58ca19edc043
clfilter: add impactable filter
The `mutable` filter still have some chance to get invalidated. This will happen
when:
- you garbage collect hidden changeset,
- public phase is moved backward,
- something is changed in the filtering (this could be fixed)
So we introduce an even more stable filtering set: everything with a revision
number egal or higher than the first mutable changeset is filtered.
The only official use of this filter is for branchcache.
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Wed, 02 Jan 2013 02:02:41 +0100 |
parents | aff706b3a21c |
children | 378a025ff269 |
line wrap: on
line diff
--- a/mercurial/repoview.py Wed Jan 02 01:57:46 2013 +0100 +++ b/mercurial/repoview.py Wed Jan 02 02:02:41 2013 +0100 @@ -40,10 +40,34 @@ return frozenset(repo.revs('draft() + secret()')) return frozenset() +def computeimpactable(repo): + """Everything impactable by mutable revision + + The mutable filter still have some chance to get invalidated. This will + happen when: + + - you garbage collect hidden changeset, + - public phase is moved backward, + - something is changed in the filtering (this could be fixed) + + This filter out any mutable changeset and any public changeset that may be + impacted by something happening to a mutable revision. + + This is achieved by filtered everything with a revision number egal or + higher than the first mutable changeset is filtered.""" + assert not repo.changelog.filteredrevs + cl = repo.changelog + firstmutable = len(cl) + for roots in repo._phasecache.phaseroots[1:]: + if roots: + firstmutable = min(firstmutable, min(cl.rev(r) for r in roots)) + return frozenset(xrange(firstmutable, len(cl))) + # function to compute filtered set filtertable = {'hidden': computehidden, 'unserved': computeunserved, - 'mutable': computemutable} + 'mutable': computemutable, + 'impactable': computeimpactable} ### Nearest subset relation # Nearest subset of filter X is a filter Y so that: # * Y is included in X, @@ -52,7 +76,8 @@ # the ordering may be partial subsettable = {None: 'hidden', 'hidden': 'unserved', - 'unserved': 'mutable'} + 'unserved': 'mutable', + 'mutable': 'impactable'} def filteredrevs(repo, filtername): """returns set of filtered revision for this filter name"""