Show More
@@ -999,7 +999,7 b' def perfrevlogrevision(ui, repo, file_, ' | |||||
999 | def dohash(text): |
|
999 | def dohash(text): | |
1000 | if not cache: |
|
1000 | if not cache: | |
1001 | r.clearcaches() |
|
1001 | r.clearcaches() | |
1002 |
r. |
|
1002 | r.checkhash(text, node, rev=rev) | |
1003 |
|
1003 | |||
1004 | def dorevision(): |
|
1004 | def dorevision(): | |
1005 | if not cache: |
|
1005 | if not cache: |
@@ -148,7 +148,7 b' class bundlerevlog(revlog.revlog):' | |||||
148 | delta = self._chunk(chain.pop()) |
|
148 | delta = self._chunk(chain.pop()) | |
149 | text = mdiff.patches(text, [delta]) |
|
149 | text = mdiff.patches(text, [delta]) | |
150 |
|
150 | |||
151 |
self. |
|
151 | self.checkhash(text, node, rev=rev) | |
152 | self._cache = (node, rev, text) |
|
152 | self._cache = (node, rev, text) | |
153 | return text |
|
153 | return text | |
154 |
|
154 |
@@ -104,9 +104,9 b' class filelog(revlog.revlog):' | |||||
104 |
|
104 | |||
105 | return True |
|
105 | return True | |
106 |
|
106 | |||
107 |
def checkhash(self, text, p1, p2 |
|
107 | def checkhash(self, text, node, p1=None, p2=None, rev=None): | |
108 | try: |
|
108 | try: | |
109 |
super(filelog, self).checkhash(text, p1, p2 |
|
109 | super(filelog, self).checkhash(text, node, p1=p1, p2=p2, rev=rev) | |
110 | except error.RevlogError: |
|
110 | except error.RevlogError: | |
111 | if _censoredtext(text): |
|
111 | if _censoredtext(text): | |
112 | raise error.CensoredNodeError(self.indexfile, node, text) |
|
112 | raise error.CensoredNodeError(self.indexfile, node, text) |
@@ -1247,9 +1247,7 b' class revlog(object):' | |||||
1247 | bins = bins[1:] |
|
1247 | bins = bins[1:] | |
1248 |
|
1248 | |||
1249 | text = mdiff.patches(text, bins) |
|
1249 | text = mdiff.patches(text, bins) | |
1250 |
|
1250 | self.checkhash(text, node, rev=rev) | ||
1251 | text = self._checkhash(text, node, rev) |
|
|||
1252 |
|
||||
1253 | self._cache = (node, rev, text) |
|
1251 | self._cache = (node, rev, text) | |
1254 | return text |
|
1252 | return text | |
1255 |
|
1253 | |||
@@ -1261,12 +1259,14 b' class revlog(object):' | |||||
1261 | """ |
|
1259 | """ | |
1262 | return hash(text, p1, p2) |
|
1260 | return hash(text, p1, p2) | |
1263 |
|
1261 | |||
1264 |
def |
|
1262 | def checkhash(self, text, node, p1=None, p2=None, rev=None): | |
1265 | p1, p2 = self.parents(node) |
|
1263 | """Check node hash integrity. | |
1266 | self.checkhash(text, p1, p2, node, rev) |
|
|||
1267 | return text |
|
|||
1268 |
|
|
1264 | ||
1269 | def checkhash(self, text, p1, p2, node, rev=None): |
|
1265 | Available as a function so that subclasses can extend hash mismatch | |
|
1266 | behaviors as needed. | |||
|
1267 | """ | |||
|
1268 | if p1 is None and p2 is None: | |||
|
1269 | p1, p2 = self.parents(node) | |||
1270 | if node != self.hash(text, p1, p2): |
|
1270 | if node != self.hash(text, p1, p2): | |
1271 | revornode = rev |
|
1271 | revornode = rev | |
1272 | if revornode is None: |
|
1272 | if revornode is None: | |
@@ -1441,7 +1441,7 b' class revlog(object):' | |||||
1441 | basetext = self.revision(self.node(baserev), _df=fh) |
|
1441 | basetext = self.revision(self.node(baserev), _df=fh) | |
1442 | btext[0] = mdiff.patch(basetext, delta) |
|
1442 | btext[0] = mdiff.patch(basetext, delta) | |
1443 | try: |
|
1443 | try: | |
1444 |
self.checkhash(btext[0], p1, p2 |
|
1444 | self.checkhash(btext[0], node, p1=p1, p2=p2) | |
1445 | if flags & REVIDX_ISCENSORED: |
|
1445 | if flags & REVIDX_ISCENSORED: | |
1446 | raise RevlogError(_('node %s is not censored') % node) |
|
1446 | raise RevlogError(_('node %s is not censored') % node) | |
1447 | except CensoredNodeError: |
|
1447 | except CensoredNodeError: |
General Comments 0
You need to be logged in to leave comments.
Login now