diff hgext/obsolete.py @ 87:246b8fefd0a5

[evolution/obsolete] very experimental and crude evolve support.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Mon, 19 Sep 2011 03:18:08 +0200
parents 7f763bada042
children 757153438e58
line wrap: on
line diff
--- a/hgext/obsolete.py	Mon Sep 19 01:57:43 2011 +0200
+++ b/hgext/obsolete.py	Mon Sep 19 03:18:08 2011 +0200
@@ -283,6 +283,27 @@
         rels.setdefault( subnode, set()).add(bin(objhex))
     return rels
 
+### diagnostique tools
+#############################
+
+def unstables(repo):
+    """Return all unstable changeset"""
+    return scmutil.revrange(repo, ['obsolete():: and (not obsolete())'])
+
+def newerversion(repo, obs):
+    """Return the newer version of an obsolete changeset"""
+    toproceed = set([obs])
+    # XXX know optimization available
+    newer = set()
+    while toproceed:
+        current = toproceed.pop()
+        if current in repo._obsobjrels:
+            toproceed.update(repo._obsobjrels[current])
+        elif current is not None: # None is kill
+            newer.add(current)
+    return sorted(newer)
+
+
 ### repo subclassing
 #############################