changeset 13239:12ed25f39d0b

revlog: break hash checking into subfunction
author Matt Mackall <mpm@selenic.com>
date Thu, 06 Jan 2011 17:04:41 -0600
parents 1b591f9b7fd2
children e5060aa22043
files mercurial/revlog.py
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Thu Jan 06 17:04:33 2011 -0600
+++ b/mercurial/revlog.py	Thu Jan 06 17:04:41 2011 -0600
@@ -1088,13 +1088,18 @@
 
         bins = [self._chunk(r) for r in chain]
         text = mdiff.patches(text, bins)
+
+        text = self._checkhash(text, node)
+
+        self._cache = (node, rev, text)
+        return text
+
+    def _checkhash(self, text, node):
         p1, p2 = self.parents(node)
         if (node != hash(text, p1, p2) and
             not (self.flags(rev) & REVIDX_PUNCHED_FLAG)):
             raise RevlogError(_("integrity check failed on %s:%d")
                               % (self.indexfile, rev))
-
-        self._cache = (node, rev, text)
         return text
 
     def checkinlinesize(self, tr, fp=None):