changeset 24045:43061f96e40e

obsolete: pass only new markers to _checkinvalidmarkers() We will soon delay populating precursors until we have to. To prepare for that, make _checkinvalidmarkers() scan for a nullid precursor in the list of new markers instead of the (currently) cheaper 'if nullid in precursors' check.
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 04 Feb 2015 22:40:48 -0800
parents e0e6dd806b23
children 6e1d9f9932a9
files mercurial/obsolete.py
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/obsolete.py	Tue Jan 20 22:01:37 2015 -0800
+++ b/mercurial/obsolete.py	Wed Feb 04 22:40:48 2015 -0800
@@ -489,15 +489,16 @@
             for p in parents:
                 children.setdefault(p, set()).add(mark)
 
-def _checkinvalidmarkers(obsstore):
+def _checkinvalidmarkers(markers):
     """search for marker with invalid data and raise error if needed
 
     Exist as a separated function to allow the evolve extension for a more
     subtle handling.
     """
-    if node.nullid in obsstore.precursors:
-        raise util.Abort(_('bad obsolescence marker detected: '
-                           'invalid successors nullid'))
+    for mark in markers:
+        if node.nullid in mark[1]:
+            raise util.Abort(_('bad obsolescence marker detected: '
+                               'invalid successors nullid'))
 
 class obsstore(object):
     """Store obsolete markers
@@ -629,7 +630,7 @@
         _addsuccessors(self.successors, markers)
         _addprecursors(self.precursors, markers)
         _addchildren(self.children, markers)
-        _checkinvalidmarkers(self)
+        _checkinvalidmarkers(markers)
 
     def relevantmarkers(self, nodes):
         """return a set of all obsolescence markers relevant to a set of nodes.