Mercurial > hg
comparison mercurial/revlog.py @ 13239:12ed25f39d0b
revlog: break hash checking into subfunction
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 06 Jan 2011 17:04:41 -0600 |
parents | 3da456d0c885 |
children | 61c9bc3da402 |
comparison
equal
deleted
inserted
replaced
13238:1b591f9b7fd2 | 13239:12ed25f39d0b |
---|---|
1086 if text is None: | 1086 if text is None: |
1087 text = self._chunk(base) | 1087 text = self._chunk(base) |
1088 | 1088 |
1089 bins = [self._chunk(r) for r in chain] | 1089 bins = [self._chunk(r) for r in chain] |
1090 text = mdiff.patches(text, bins) | 1090 text = mdiff.patches(text, bins) |
1091 | |
1092 text = self._checkhash(text, node) | |
1093 | |
1094 self._cache = (node, rev, text) | |
1095 return text | |
1096 | |
1097 def _checkhash(self, text, node): | |
1091 p1, p2 = self.parents(node) | 1098 p1, p2 = self.parents(node) |
1092 if (node != hash(text, p1, p2) and | 1099 if (node != hash(text, p1, p2) and |
1093 not (self.flags(rev) & REVIDX_PUNCHED_FLAG)): | 1100 not (self.flags(rev) & REVIDX_PUNCHED_FLAG)): |
1094 raise RevlogError(_("integrity check failed on %s:%d") | 1101 raise RevlogError(_("integrity check failed on %s:%d") |
1095 % (self.indexfile, rev)) | 1102 % (self.indexfile, rev)) |
1096 | |
1097 self._cache = (node, rev, text) | |
1098 return text | 1103 return text |
1099 | 1104 |
1100 def checkinlinesize(self, tr, fp=None): | 1105 def checkinlinesize(self, tr, fp=None): |
1101 if not self._inline or (self.start(-2) + self.length(-2)) < _maxinline: | 1106 if not self._inline or (self.start(-2) + self.length(-2)) < _maxinline: |
1102 return | 1107 return |