Mercurial > hg
diff mercurial/repoview.py @ 18382:f3b21beb9802
filtering: rename filters to their antonyms
Now that changelog filtering is in place, it's become evident that
naming the filters according to the set of revs _not_ included in the
filtered changelog is confusing. This is especially evident in the
collaborative branch cache scheme.
This changes the names of the filters to reflect the revs that _are_
included:
hidden -> visible
unserved -> served
mutable -> immutable
impactable -> base
repoview.filteredrevs is renamed to filterrevs, so that callers read a
bit more sensibly, e.g.:
filterrevs('visible') # filter revs according to what's visible
author | Kevin Bullock <kbullock@ringworld.org> |
---|---|
date | Sun, 13 Jan 2013 01:39:16 -0600 |
parents | 1f35d6737ed8 |
children | 64848f7fb764 |
line wrap: on
line diff
--- a/mercurial/repoview.py Tue Jan 15 20:55:47 2013 +0100 +++ b/mercurial/repoview.py Sun Jan 13 01:39:16 2013 -0600 @@ -44,7 +44,7 @@ Secret and hidden changeset should not pretend to be here.""" assert not repo.changelog.filteredrevs # fast path in simple case to avoid impact of non optimised code - hiddens = filteredrevs(repo, 'hidden') + hiddens = filterrevs(repo, 'visible') if phases.hassecret(repo): cl = repo.changelog secret = phases.secret @@ -65,7 +65,7 @@ # fast check to avoid revset call on huge repo if util.any(repo._phasecache.phaseroots[1:]): getphase = repo._phasecache.phase - maymutable = filteredrevs(repo, 'impactable') + maymutable = filterrevs(repo, 'base') return frozenset(r for r in maymutable if getphase(repo, r)) return frozenset() @@ -93,22 +93,22 @@ return frozenset(xrange(firstmutable, len(cl))) # function to compute filtered set -filtertable = {'hidden': computehidden, - 'unserved': computeunserved, - 'mutable': computemutable, - 'impactable': computeimpactable} +filtertable = {'visible': computehidden, + 'served': computeunserved, + 'immutable': computemutable, + 'base': computeimpactable} ### Nearest subset relation # Nearest subset of filter X is a filter Y so that: # * Y is included in X, # * X - Y is as small as possible. # This create and ordering used for branchmap purpose. # the ordering may be partial -subsettable = {None: 'hidden', - 'hidden': 'unserved', - 'unserved': 'mutable', - 'mutable': 'impactable'} +subsettable = {None: 'visible', + 'visible': 'served', + 'served': 'immutable', + 'immutable': 'base'} -def filteredrevs(repo, filtername): +def filterrevs(repo, filtername): """returns set of filtered revision for this filter name""" if filtername not in repo.filteredrevcache: func = filtertable[filtername] @@ -162,7 +162,7 @@ this changelog must not be used for writing""" # some cache may be implemented later cl = copy.copy(self._unfilteredrepo.changelog) - cl.filteredrevs = filteredrevs(self._unfilteredrepo, self.filtername) + cl.filteredrevs = filterrevs(self._unfilteredrepo, self.filtername) return cl def unfiltered(self):