[PATCH 2 of 2] obsolete: mark unreachable extinct changesets as hidden
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Mon Jul 16 11:03:57 CDT 2012
# HG changeset patch
# User Pierre-Yves.David at ens-lyon.org
# Date 1342454210 -7200
# Node ID 9ad7d418e2e6c5efb7cfa6e376939b0adac29b83
# Parent 34383709336f93d2b68f1e6af7402520375688f2
obsolete: mark unreachable extinct changesets as hidden
The repo.hiddenrevs set is updated with all extinct() changesets which ain't
descendants of either:
- the current working copy,
- a bookmark,
- a tag.
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -51,12 +51,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)
@@ -208,6 +202,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)
diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -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
More information about the Mercurial-devel
mailing list