changeset 22270:e5adb6935239

obsstore: keep track of children information We use the new `parents` field to build a dictionary of markers that touch children of a node. This will be used to link prune markers to a set of exchanged nodes.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 19 Aug 2014 16:53:53 -0700
parents 03cc81a28228
children 8c69262df82d
files mercurial/obsolete.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/obsolete.py	Wed Aug 20 17:36:54 2014 -0700
+++ b/mercurial/obsolete.py	Tue Aug 19 16:53:53 2014 -0700
@@ -265,6 +265,7 @@
     Markers can be accessed with two mappings:
     - precursors[x] -> set(markers on precursors edges of x)
     - successors[x] -> set(markers on successors edges of x)
+    - children[x]   -> set(markers on precursors edges of children(x)
     """
 
     fields = ('prec', 'succs', 'flag', 'meta', 'date', 'parents')
@@ -282,6 +283,7 @@
         self._all = []
         self.precursors = {}
         self.successors = {}
+        self.children = {}
         self.sopener = sopener
         data = sopener.tryread('obsstore')
         if data:
@@ -376,6 +378,10 @@
             self.successors.setdefault(pre, set()).add(mark)
             for suc in sucs:
                 self.precursors.setdefault(suc, set()).add(mark)
+            parents = mark[5]
+            if parents is not None:
+                for p in parents:
+                    self.children.setdefault(p, set()).add(mark)
         if node.nullid in self.precursors:
             raise util.Abort(_('bad obsolescence marker detected: '
                                'invalid successors nullid'))