--- a/obsolete.py Wed Sep 07 12:08:24 2011 +0200
+++ b/obsolete.py Wed Sep 07 12:09:05 2011 +0200
@@ -8,6 +8,7 @@
from mercurial import util
from mercurial import context
+from mercurial import revset
from mercurial.node import hex, bin
# Patch changectx
@@ -27,6 +28,16 @@
return ohidden(ctx)
context.changectx.hidden = hidden
+# revset
+#############################
+
+def revsetobsolete(repo, subset, x):
+ args = revset.getargs(x, 0, 0, 'publicheads takes no arguments')
+ return [r for r in subset if repo[r].obsolete()] # XXX slow
+
+def extsetup(ui):
+ revset.symbols["obsolete"] = revsetobsolete
+
# New commands
#############################
--- a/tests/test-obsolete.t Wed Sep 07 12:08:24 2011 +0200
+++ b/tests/test-obsolete.t Wed Sep 07 12:09:05 2011 +0200
@@ -11,8 +11,8 @@
> hg ci -m "add $1"
> }
- $ hg init repo
- $ cd repo
+ $ hg init local
+ $ cd local
$ mkcommit a # 0
$ mkcommit b # 1
$ mkcommit c # 2
@@ -21,6 +21,10 @@
$ mkcommit obsol_c # 3
created new head
$ hg debugobsolete 3 2
+
+
+Test that obsolete changeset are hidden
+
$ hg log
changeset: 3:0d3f46688ccc
tag: tip
@@ -62,3 +66,10 @@
date: Thu Jan 01 00:00:00 1970 +0000
summary: add a
+ $ hg log -r 'obsolete()' --hidden
+ changeset: 2:4538525df7e2
+ user: test
+ date: Thu Jan 01 00:00:00 1970 +0000
+ summary: add c
+
+