##// END OF EJS Templates
revlog: extract 'checkhash' method...
Wojciech Lopata -
r19624:55749cb1 default
parent child Browse files
Show More
@@ -14,7 +14,7 b' and O(changes) merge between branches.'
14 14 # import stuff from node for others to import from revlog
15 15 from node import bin, hex, nullid, nullrev
16 16 from i18n import _
17 import ancestor, mdiff, parsers, error, util
17 import ancestor, mdiff, parsers, error, util, templatefilters
18 18 import struct, zlib, errno
19 19
20 20 _pack = struct.pack
@@ -943,10 +943,16 b' class revlog(object):'
943 943
944 944 def _checkhash(self, text, node, rev):
945 945 p1, p2 = self.parents(node)
946 self.checkhash(text, p1, p2, node, rev)
947 return text
948
949 def checkhash(self, text, p1, p2, node, rev=None):
946 950 if node != hash(text, p1, p2):
947 raise RevlogError(_("integrity check failed on %s:%d")
948 % (self.indexfile, rev))
949 return text
951 revornode = rev
952 if revornode is None:
953 revornode = templatefilters.short(hex(node))
954 raise RevlogError(_("integrity check failed on %s:%s")
955 % (self.indexfile, revornode))
950 956
951 957 def checkinlinesize(self, tr, fp=None):
952 958 if not self._inline or (self.start(-2) + self.length(-2)) < _maxinline:
@@ -1063,9 +1069,7 b' class revlog(object):'
1063 1069 ifh.flush()
1064 1070 basetext = self.revision(self.node(cachedelta[0]))
1065 1071 btext[0] = mdiff.patch(basetext, cachedelta[1])
1066 chk = hash(btext[0], p1, p2)
1067 if chk != node:
1068 raise RevlogError(_("consistency error in delta"))
1072 self.checkhash(btext[0], p1, p2, node)
1069 1073 return btext[0]
1070 1074
1071 1075 def builddelta(rev):
General Comments 0
You need to be logged in to leave comments. Login now