diff mercurial/revset.py @ 17173:c621f84dbb35

obsolete: compute extinct changesets `extinct` changesets are obsolete changesets with obsolete descendants only. They are of no interest anymore and can be: - exclude from exchange - hidden to the user in most situation - safely garbage collected This changeset just allows mercurial to detect them. The implementation is a bit naive, as for unstable changesets. We better use a simple revset query and a cache, but simple version comes first.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Fri, 06 Jul 2012 19:34:09 +0200
parents 9c750c3e4fac
children 2c7c4824969e
line wrap: on
line diff
--- a/mercurial/revset.py	Tue Jul 10 01:39:03 2012 +0200
+++ b/mercurial/revset.py	Fri Jul 06 19:34:09 2012 +0200
@@ -568,6 +568,13 @@
     pc = repo._phasecache
     return [r for r in subset if pc.phase(repo, r) == phases.draft]
 
+def extinct(repo, subset, x):
+    """``extinct()``
+    obsolete changeset with obsolete descendant only."""
+    getargs(x, 0, 0, _("obsolete takes no arguments"))
+    extinctset = set(repo.revs('(obsolete()::) - (::(not obsolete()))'))
+    return [r for r in subset if r in extinctset]
+
 def extra(repo, subset, x):
     """``extra(label, [value])``
     Changesets with the given label in the extra metadata, with the given
@@ -1365,6 +1372,7 @@
     "descendants": descendants,
     "_firstdescendants": _firstdescendants,
     "draft": draft,
+    "extinct": extinct,
     "extra": extra,
     "file": hasfile,
     "filelog": filelog,