##// END OF EJS Templates
mdiff.patch(): add a special case for when the base text is empty...
Benoit Boissinot -
r12025:2315a95e default
parent child Browse files
Show More
@@ -260,6 +260,9 b' def patchtext(bin):'
260 return "".join(t)
260 return "".join(t)
261
261
262 def patch(a, bin):
262 def patch(a, bin):
263 if len(a) == 0:
264 # skip over trivial delta header
265 return buffer(bin, 12)
263 return mpatch.patches(a, [bin])
266 return mpatch.patches(a, [bin])
264
267
265 # similar to difflib.SequenceMatcher.get_matching_blocks
268 # similar to difflib.SequenceMatcher.get_matching_blocks
@@ -1353,12 +1353,7 b' class revlog(object):'
1353 dfh.flush()
1353 dfh.flush()
1354 ifh.flush()
1354 ifh.flush()
1355 text = self.revision(chain)
1355 text = self.revision(chain)
1356 if len(text) == 0:
1356 text = mdiff.patch(text, delta)
1357 # skip over trivial delta header
1358 # text == '' in the case of nullrev or punched revision
1359 text = buffer(delta, 12)
1360 else:
1361 text = mdiff.patches(text, [delta])
1362 del delta
1357 del delta
1363 chk = self._addrevision(node, text, transaction, link,
1358 chk = self._addrevision(node, text, transaction, link,
1364 p1, p2, None, ifh, dfh)
1359 p1, p2, None, ifh, dfh)
General Comments 0
You need to be logged in to leave comments. Login now