Patchwork [17,of,22] obsstore: move _checkinvalidmarkers to markerreader

login
register
mail settings
Submitter Jun Wu
Date June 4, 2017, 11:59 p.m.
Message ID <df25a444c9f9f1b0860d.1496620769@x1c>
Download mbox | patch
Permalink /patch/21194/
State Accepted
Headers show

Comments

Jun Wu - June 4, 2017, 11:59 p.m.
# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1496604735 25200
#      Sun Jun 04 12:32:15 2017 -0700
# Node ID df25a444c9f9f1b0860d782d6adceadd5cc810fd
# Parent  646ef5fdcf3750f40cb3cf1c710c0222aef24beb
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r df25a444c9f9
obsstore: move _checkinvalidmarkers to markerreader

markerreader is the lowest-level marker reading utility. Move marker
checking there to make sure we won't miss checks.

Patch

diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -578,4 +578,5 @@  class markerreader(object):
             _version, (newmarkers, newoffsets) = _readmarkers(
                 data, offset, withoffsets=True)
+            _checkinvalidmarkers(newmarkers)
             markers[:] = newmarkers
             offsets[:] = newoffsets
@@ -587,4 +588,5 @@  class markerreader(object):
             _version, (newmarkers, newoffsets) = _readmarkers(
                 data, self._lastlen, withoffsets=True)
+            _checkinvalidmarkers(newmarkers)
             markers.extend(newmarkers)
             offsets.extend(newoffsets)
@@ -598,4 +600,5 @@  class markerreader(object):
             _version, (newmarkers, newoffsets) = _readmarkers(
                 data, offset, offsets[0], withoffsets=True)
+            _checkinvalidmarkers(newmarkers)
             markers[0:0] = newmarkers
             offsets[0:0] = newoffsets
@@ -775,5 +778,4 @@  class obsstore(object):
     def _all(self):
         markers, _offsets = self._readmarkers()
-        _checkinvalidmarkers(markers)
         return markers
 
@@ -801,5 +803,4 @@  class obsstore(object):
             if index is not None:
                 index.update()
-        _checkinvalidmarkers(markers)
 
     def relevantmarkers(self, nodes):