Patchwork [3,of,7,Series-A] hidden: move computation in filter function

login
register
mail settings
Submitter Pierre-Yves David
Date Jan. 7, 2013, 6:30 p.m.
Message ID <b04d0f4dfa0d2a1fe0cc.1357583435@crater2.logilab.fr>
Download mbox | patch
Permalink /patch/490/
State Accepted
Commit 378a025ff26959e4b3cef140748d6cbe66b7e715
Headers show

Comments

Pierre-Yves David - Jan. 7, 2013, 6:30 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1357235244 -3600
# Node ID b04d0f4dfa0d2a1fe0cc5285cef99ddaeeb41af6
# Parent  6d3722e0bb15da9f69666732bd53fdca07e7e184
hidden: move computation in filter function

There is not good reason for this computation to be handle in a different way
from the other. We are moving the computation of hidden revs in the filter
function. In later changesets, code that access to `repo.hiddenrevs` will be
updated and the property dropped.
Kevin Bullock - Jan. 8, 2013, 1:42 a.m.
On 7 Jan 2013, at 12:30 PM, pierre-yves.david at logilab.fr wrote:

> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at logilab.fr>
> # Date 1357235244 -3600
> # Node ID b04d0f4dfa0d2a1fe0cc5285cef99ddaeeb41af6
> # Parent  6d3722e0bb15da9f69666732bd53fdca07e7e184
> hidden: move computation in filter function
> 
> There is not good reason for this computation to be handle in a different way
> from the other. We are moving the computation of hidden revs in the filter
> function. In later changesets, code that access to `repo.hiddenrevs` will be
> updated and the property dropped.

Commit message should mention that we're dropping the propertycache (along with its invalidation) because filters are all cached together.

pacem in terris / ??? / ?????? / ????????? / ??
Kevin R. Bullock

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -348,11 +348,12 @@  class localrepository(object):
             # message is rare enough to not be translated
             msg = 'obsolete feature not enabled but %i markers found!\n'
             self.ui.warn(msg % len(list(store)))
         return store
 
-    @unfilteredpropertycache
+    @property
+    @unfiltered
     def hiddenrevs(self):
         """hiddenrevs: revs that should be hidden by command and tools
 
         This set is carried on the repo to ease initialization and lazy
         loading; it'll probably move back to changelog for efficiency and
@@ -362,16 +363,11 @@  class localrepository(object):
         - a new changesets is added (possible unstable above extinct)
         - a new obsolete marker is added (possible new extinct changeset)
 
         hidden changesets cannot have non-hidden descendants
         """
-        hidden = set()
-        if self.obsstore:
-            ### hide extinct changeset that are not accessible by any mean
-            hiddenquery = 'extinct() - ::(. + bookmark())'
-            hidden.update(self.revs(hiddenquery))
-        return hidden
+        return repoview.filteredrevs(self, 'hidden')
 
     @storecache('00changelog.i')
     def changelog(self):
         c = changelog.changelog(self.sopener)
         if 'HG_PENDING' in os.environ:
@@ -964,12 +960,10 @@  class localrepository(object):
         self.invalidatevolatilesets()
 
     def invalidatevolatilesets(self):
         self.filteredrevcache.clear()
         obsolete.clearobscaches(self)
-        if 'hiddenrevs' in vars(self):
-            del self.hiddenrevs
 
     def invalidatedirstate(self):
         '''Invalidates the dirstate, causing the next call to dirstate
         to check if it was modified since the last time it was read,
         rereading it if it has.
diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -15,11 +15,13 @@  def computehidden(repo):
     """compute the set of hidden revision to filter
 
     During most operation hidden should be filtered."""
     assert not repo.changelog.filteredrevs
     if repo.obsstore:
-        return frozenset(repo.revs('hidden()'))
+        ### hide extinct changeset that are not accessible by any mean
+        hiddenquery = 'extinct() - ::(. + bookmark())'
+        return frozenset(repo.revs(hiddenquery))
     return frozenset()
 
 def computeunserved(repo):
     """compute the set of revision that should be filtered when used a server