# HG changeset patch # User Pierre-Yves David # Date 1392859665 28800 # Node ID 895fadf6ba3e1a8c55064acea7ec4174f4fbcd1b # Parent 66c02a2e8e2f1b639329f91c311bc93713ae1b94 evolve: extend obsstore object to use prune parent information Now that we have the information, we can use it to build a mapping to access all marker that prune a children of a node. This is similar to what we do for successors and precursors. The performance impact is a few tens of second on my mercurial clone. Experimenting is worth the trouble. diff -r 66c02a2e8e2f -r 895fadf6ba3e hgext/evolve.py --- 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 ### #####################################################################