revset: add an `obsolete` symbol
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Fri, 06 Jul 2012 19:29:10 +0200
changeset 17170 63a4a3871607
parent 17169 c18ecebed3f1
child 17171 9c750c3e4fac
revset: add an `obsolete` symbol This predicate matches obsolete changesets. This is a naive implementation to be improved later.
mercurial/revset.py
tests/test-obsolete.t
--- 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