Patchwork [STABLE] obsstore: make the invalid markers check wrap-able

login
register
mail settings
Submitter Pierre-Yves David
Date Jan. 30, 2015, 6:55 p.m.
Message ID <cb4781131f2b935df9a4.1422644142@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/7582/
State Accepted
Commit 18d431147cc133dbcd255b90944d2d6b1288268b
Headers show

Comments

Pierre-Yves David - Jan. 30, 2015, 6:55 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1422643773 0
#      Fri Jan 30 18:49:33 2015 +0000
# Branch stable
# Node ID cb4781131f2b935df9a4e944cbd5ffee71d2ceaa
# Parent  6becb9dbca25057c6186e255a48dd2c2ce5701a5
obsstore: make the invalid markers check wrap-able

Some evolve user ignored the invalid markers for about two years and still have
some of them in some repository. This lead to plain abort whenever mercurial try
to open such repo. We need reinstall some way to clean this up in the evolve
extension. For this purpose, we need the checker code wrap-able independently.

This is scheduled for stable as this issue is blocking some evolve user.
Matt Mackall - Feb. 1, 2015, 8:11 p.m.
On Fri, 2015-01-30 at 18:55 +0000, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@fb.com>
> # Date 1422643773 0
> #      Fri Jan 30 18:49:33 2015 +0000
> # Branch stable
> # Node ID cb4781131f2b935df9a4e944cbd5ffee71d2ceaa
> # Parent  6becb9dbca25057c6186e255a48dd2c2ce5701a5
> obsstore: make the invalid markers check wrap-able

Queued for stable, thanks.

Patch

diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -460,10 +460,20 @@  class marker(object):
 
     def flags(self):
         """The flags field of the marker"""
         return self._data[2]
 
+def _checkinvalidmarkers(obsstore):
+    """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'))
+
 class obsstore(object):
     """Store obsolete markers
 
     Markers can be accessed with two mappings:
     - precursors[x] -> set(markers on precursors edges of x)
@@ -596,13 +606,12 @@  class obsstore(object):
                 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'))
+        _checkinvalidmarkers(self)
+
     def relevantmarkers(self, nodes):
         """return a set of all obsolescence markers relevant to a set of nodes.
 
         "relevant" to a set of nodes mean: