# HG changeset patch # User Patrick Mezard # Date 1321622207 -3600 # Node ID b35cf47286a6bf7fe6e7f63f1d56e1b5f96bf4b3 # Parent a84698badf0b7e42afb9582d9711cac66fc2a743 mdiff: split lines in allblocks() only when necessary These are only required to handle the --ignore-blank-lines case diff -r a84698badf0b -r b35cf47286a6 mercurial/mdiff.py --- a/mercurial/mdiff.py Fri Nov 18 12:04:31 2011 +0100 +++ b/mercurial/mdiff.py Fri Nov 18 14:16:47 2011 +0100 @@ -112,10 +112,6 @@ """ if opts is None: opts = defaultopts - if lines1 is None: - lines1 = splitnewlines(text1) - if lines2 is None: - lines2 = splitnewlines(text2) if opts.ignorews or opts.ignorewsamount: text1 = wsclean(opts, text1, False) text2 = wsclean(opts, text2, False) @@ -130,17 +126,19 @@ else: s = [0, 0, 0, 0] s = [s[1], s1[0], s[3], s1[2]] - old = lines1[s[0]:s[1]] - new = lines2[s[2]:s[3]] # bdiff sometimes gives huge matches past eof, this check eats them, # and deals with the special first match case described above - if old or new: + if s[0] != s[1] or s[2] != s[3]: type = '!' if opts.ignoreblanklines: - cold = wsclean(opts, "".join(old)) - cnew = wsclean(opts, "".join(new)) - if cold == cnew: + if lines1 is None: + lines1 = splitnewlines(text1) + if lines2 is None: + lines2 = splitnewlines(text2) + old = wsclean(opts, "".join(lines1[s[0]:s[1]])) + new = wsclean(opts, "".join(lines2[s[2]:s[3]])) + if old == new: type = '~' yield s, type yield s1, '='