diff mercurial/revlog.py @ 43034:294afb982a88

sidedata: add a function to read sidedata from revlog raw text This implement the "reading" part of a `sidedata` flag processor. Differential Revision: https://phab.mercurial-scm.org/D6890
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 04 Sep 2019 00:59:15 +0200
parents 827cb4fe62a3
children 142deb539ccf
line wrap: on
line diff
--- a/mercurial/revlog.py	Mon Sep 09 14:03:12 2019 +0200
+++ b/mercurial/revlog.py	Wed Sep 04 00:59:15 2019 +0200
@@ -1675,7 +1675,13 @@
             validatehash = flagutil.processflagsraw(self, rawtext, flags)
             text = rawtext
         else:
-            r = flagutil.processflagsread(self, rawtext, flags)
+            try:
+                r = flagutil.processflagsread(self, rawtext, flags)
+            except error.SidedataHashError as exc:
+                msg = _("integrity check failed on %s:%s sidedata key %d")
+                msg %= (self.indexfile, pycompat.bytestr(rev),
+                        exc.sidedatakey)
+                raise error.RevlogError(msg)
             text, validatehash, sidedata = r
         if validatehash:
             self.checkhash(text, node, rev=rev)