changeset 17170:63a4a3871607

revset: add an `obsolete` symbol This predicate matches obsolete changesets. This is a naive implementation to be improved later.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Fri, 06 Jul 2012 19:29:10 +0200
parents c18ecebed3f1
children 9c750c3e4fac
files mercurial/revset.py tests/test-obsolete.t
diffstat 2 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Tue Jul 10 01:32:18 2012 +0200
+++ b/mercurial/revset.py	Fri Jul 06 19:29:10 2012 +0200
@@ -875,6 +875,12 @@
 
     return [r for r in subset if r == rn]
 
+def obsolete(repo, subset, x):
+    """``obsolete()``
+    Mutable changeset with a newer version."""
+    getargs(x, 0, 0, _("obsolete takes no arguments"))
+    return [r for r in subset if repo[r].obsolete()]
+
 def outgoing(repo, subset, x):
     """``outgoing([path])``
     Changesets not found in the specified destination repository, or the
@@ -1369,6 +1375,7 @@
     "merge": merge,
     "min": minrev,
     "modifies": modifies,
+    "obsolete": obsolete,
     "outgoing": outgoing,
     "p1": p1,
     "p2": p2,
--- a/tests/test-obsolete.t	Tue Jul 10 01:32:18 2012 +0200
+++ b/tests/test-obsolete.t	Fri Jul 06 19:29:10 2012 +0200
@@ -193,7 +193,7 @@
   abort: push includes an obsolete changeset: cdbce2fbb163!
   [255]
   $ hg -R tmpd debugobsolete
-  $ hg -R tmpb push tmpd --rev 5601fb93a350 --rev 245bde4270cd
+  $ hg -R tmpb push tmpd --rev 'not obsolete()'
   pushing to tmpd
   searching for changes
   adding changesets