hgext/evolve.py
changeset 806 895fadf6ba3e
parent 805 66c02a2e8e2f
child 807 4dd1cda16fd0
--- a/hgext/evolve.py	Thu Feb 13 18:09:54 2014 -0800
+++ b/hgext/evolve.py	Wed Feb 19 17:27:45 2014 -0800
@@ -325,6 +325,31 @@
 def createmarkers(*args, **kwargs):
     return obsolete.createmarkers(*args, **kwargs)
 
+class pruneobsstore(obsolete.obsstore):
+
+    def __init__(self, *args, **kwargs):
+        self.prunedchildren = {}
+        return super(pruneobsstore, self).__init__(*args, **kwargs)
+
+    def _load(self, markers):
+        markers = self._prunedetectingmarkers(markers)
+        return super(pruneobsstore, self)._load(markers)
+
+
+    def _prunedetectingmarkers(self, markers):
+        for m in markers:
+            if not m[1]: # no successors
+                meta = obsolete.decodemeta(m[3])
+                if 'p1' in meta:
+                    p1 = node.bin(meta['p1'])
+                    self.prunedchildren.setdefault(p1, set()).add(m)
+                if 'p2' in meta:
+                    p1 = node.bin(meta['p2'])
+                    self.prunedchildren.setdefault(p2, set()).add(m)
+            yield m
+
+obsolete.obsstore = pruneobsstore
+
 #####################################################################
 ### Critical fix                                                  ###
 #####################################################################