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