diff mercurial/localrepo.py @ 17208:8018f2340807

obsolete: mark unreachable extinct changesets as hidden The repo.hiddenrevs set is updated with all extinct() changesets which aren't descendants of either: - the current working copy, - a bookmark, - a tag.
author Pierre-Yves.David@ens-lyon.org
date Mon, 16 Jul 2012 17:56:50 +0200
parents 62c56c94c77e
children ec80ae982689
line wrap: on
line diff
--- a/mercurial/localrepo.py	Mon Jul 16 17:44:46 2012 +0200
+++ b/mercurial/localrepo.py	Mon Jul 16 17:56:50 2012 +0200
@@ -131,12 +131,6 @@
         # Callback are in the form: func(repo, roots) --> processed root.
         # This list it to be filled by extension during repo setup
         self._phasedefaults = []
-        # hiddenrevs: revs that should be hidden by command and tools
-        #
-        # This set is carried on the repo to ease initialisation and lazy
-        # loading it'll probably move back to changelog for efficienty and
-        # consistency reason
-        self.hiddenrevs = set()
         try:
             self.ui.readconfig(self.join("hgrc"), self.root)
             extensions.loadall(self.ui)
@@ -297,6 +291,25 @@
         store = obsolete.obsstore(self.sopener)
         return store
 
+    @propertycache
+    def hiddenrevs(self):
+        """hiddenrevs: revs that should be hidden by command and tools
+
+        This set is carried on the repo to ease initialisation and lazy
+        loading it'll probably move back to changelog for efficienty and
+        consistency reason
+
+        Note that the hiddenrevs will needs invalidations when
+        - a new changesets is added (possible unstable above extinct)
+        - a new obsolete marker is added (possible new extinct changeset)
+        """
+        hidden = set()
+        if self.obsstore:
+            ### hide extinct changeset that are not accessible by any mean
+            hiddenquery = 'extinct() - ::(. + bookmark() + tagged())'
+            hidden.update(self.revs(hiddenquery))
+        return hidden
+
     @storecache('00changelog.i')
     def changelog(self):
         c = changelog.changelog(self.sopener)