##// END OF EJS Templates
revlog: fix buildtext local scope...
Matt Mackall -
r12886:c25945a1 stable
parent child Browse files
Show More
@@ -1157,19 +1157,20 b' class revlog(object):'
1157 def _addrevision(self, node, text, transaction, link, p1, p2,
1157 def _addrevision(self, node, text, transaction, link, p1, p2,
1158 cachedelta, ifh, dfh):
1158 cachedelta, ifh, dfh):
1159
1159
1160 def buildtext(cachedelta):
1160 btext = [text]
1161 if text is not None:
1161 def buildtext():
1162 return text
1162 if btext[0] is not None:
1163 return btext[0]
1163 # flush any pending writes here so we can read it in revision
1164 # flush any pending writes here so we can read it in revision
1164 if dfh:
1165 if dfh:
1165 dfh.flush()
1166 dfh.flush()
1166 ifh.flush()
1167 ifh.flush()
1167 basetext = self.revision(self.node(cachedelta[0]))
1168 basetext = self.revision(self.node(cachedelta[0]))
1168 patchedtext = mdiff.patch(basetext, cachedelta[1])
1169 btext[0] = mdiff.patch(basetext, cachedelta[1])
1169 chk = hash(patchedtext, p1, p2)
1170 chk = hash(btext[0], p1, p2)
1170 if chk != node:
1171 if chk != node:
1171 raise RevlogError(_("consistency error in delta"))
1172 raise RevlogError(_("consistency error in delta"))
1172 return patchedtext
1173 return btext[0]
1173
1174
1174 curr = len(self)
1175 curr = len(self)
1175 prev = curr - 1
1176 prev = curr - 1
@@ -1190,7 +1191,7 b' class revlog(object):'
1190 if cachedelta:
1191 if cachedelta:
1191 cacherev, d = cachedelta
1192 cacherev, d = cachedelta
1192 if cacherev != deltarev:
1193 if cacherev != deltarev:
1193 text = buildtext(cachedelta)
1194 text = buildtext()
1194 d = None
1195 d = None
1195 if d is None:
1196 if d is None:
1196 ptext = self.revision(deltanode)
1197 ptext = self.revision(deltanode)
@@ -1210,7 +1211,7 b' class revlog(object):'
1210 textlen = len(text)
1211 textlen = len(text)
1211 if (d is None or dist > textlen * 2 or
1212 if (d is None or dist > textlen * 2 or
1212 (self.flags(base) & REVIDX_PUNCHED_FLAG)):
1213 (self.flags(base) & REVIDX_PUNCHED_FLAG)):
1213 text = buildtext(cachedelta)
1214 text = buildtext()
1214 data = compress(text)
1215 data = compress(text)
1215 l = len(data[1]) + len(data[0])
1216 l = len(data[1]) + len(data[0])
1216 base = curr
1217 base = curr
General Comments 0
You need to be logged in to leave comments. Login now