Comments
Patch
@@ -334,6 +334,8 @@ class manifestdict(object):
# zero copy representation of base as a buffer
addbuf = util.buffer(base)
+ changes = list(changes)
+ if len(changes) < 1000:
# start with a readonly loop that finds the offset of
# each line and creates the deltas
for f, todelete in changes:
@@ -364,6 +366,12 @@ class manifestdict(object):
delta.append([dstart, dend, "".join(dline)])
# apply the delta to the base, and get a delta for addrevision
deltatext, arraytext = _addlistdelta(base, delta)
+ else:
+ # For large changes, it's much cheaper to just build the text and
+ # diff it.
+ arraytext = array.array('c', self.text())
+ deltatext = mdiff.textdiff(base, arraytext)
+
return arraytext, deltatext
def _msearch(m, s, lo=0, hi=None):