changeset 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 5cd3e526ac37
files mercurial/localrepo.py tests/test-obsolete.t
diffstat 2 files changed, 19 insertions(+), 35 deletions(-) [+]
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)
--- a/tests/test-obsolete.t	Mon Jul 16 17:44:46 2012 +0200
+++ b/tests/test-obsolete.t	Mon Jul 16 17:56:50 2012 +0200
@@ -76,23 +76,6 @@
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     add new_3_c
   |
-  | x  changeset:   4:ca819180edb9
-  |/   parent:      1:7c3bad9141dc
-  |    user:        test
-  |    date:        Thu Jan 01 00:00:00 1970 +0000
-  |    summary:     add new_2_c
-  |
-  | x  changeset:   3:cdbce2fbb163
-  |/   parent:      1:7c3bad9141dc
-  |    user:        test
-  |    date:        Thu Jan 01 00:00:00 1970 +0000
-  |    summary:     add new_c
-  |
-  | x  changeset:   2:245bde4270cd
-  |/   user:        test
-  |    date:        Thu Jan 01 00:00:00 1970 +0000
-  |    summary:     add original_c
-  |
   o  changeset:   1:7c3bad9141dc
   |  user:        test
   |  date:        Thu Jan 01 00:00:00 1970 +0000
@@ -115,18 +98,6 @@
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     add new_3_c
   |
-  | x  changeset:   4:ca819180edb9
-  |/   parent:      1:7c3bad9141dc
-  |    user:        test
-  |    date:        Thu Jan 01 00:00:00 1970 +0000
-  |    summary:     add new_2_c
-  |
-  | x  changeset:   3:cdbce2fbb163
-  |/   parent:      1:7c3bad9141dc
-  |    user:        test
-  |    date:        Thu Jan 01 00:00:00 1970 +0000
-  |    summary:     add new_c
-  |
   | o  changeset:   2:245bde4270cd
   |/   user:        test
   |    date:        Thu Jan 01 00:00:00 1970 +0000