obsolete: define an unstable property on context
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Tue, 20 Mar 2012 10:39:07 +0100
changeset 148 8e93e1f67205
parent 147 b0b23d9eede5
child 149 03f314e32058
obsolete: define an unstable property on context
hgext/obsolete.py
--- a/hgext/obsolete.py	Tue Mar 20 10:38:38 2012 +0100
+++ b/hgext/obsolete.py	Tue Mar 20 10:39:07 2012 +0100
@@ -109,6 +109,14 @@
 
 context.changectx.obsolete = obsolete
 
+def unstable(ctx):
+    """is the changeset unstable (have obsolete ancestor)"""
+    if ctx.node() is None:
+        return False
+    return ctx.rev() in ctx._repo._unstableset
+
+context.changectx.unstable = unstable
+
 
 ### revset
 #############################