obsstore: keep track of children information
authorPierre-Yves David <pierre-yves.david@fb.com>
Tue, 19 Aug 2014 16:53:53 -0700
changeset 22270 e5adb6935239
parent 22269 03cc81a28228
child 22271 8c69262df82d
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.
mercurial/obsolete.py
--- 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'))