##// END OF EJS Templates
mdiff: split lines in allblocks() only when necessary...
Patrick Mezard -
r15529:b35cf472 default
parent child Browse files
Show More
@@ -112,10 +112,6 b' def allblocks(text1, text2, opts=None, l'
112 """
112 """
113 if opts is None:
113 if opts is None:
114 opts = defaultopts
114 opts = defaultopts
115 if lines1 is None:
116 lines1 = splitnewlines(text1)
117 if lines2 is None:
118 lines2 = splitnewlines(text2)
119 if opts.ignorews or opts.ignorewsamount:
115 if opts.ignorews or opts.ignorewsamount:
120 text1 = wsclean(opts, text1, False)
116 text1 = wsclean(opts, text1, False)
121 text2 = wsclean(opts, text2, False)
117 text2 = wsclean(opts, text2, False)
@@ -130,17 +126,19 b' def allblocks(text1, text2, opts=None, l'
130 else:
126 else:
131 s = [0, 0, 0, 0]
127 s = [0, 0, 0, 0]
132 s = [s[1], s1[0], s[3], s1[2]]
128 s = [s[1], s1[0], s[3], s1[2]]
133 old = lines1[s[0]:s[1]]
134 new = lines2[s[2]:s[3]]
135
129
136 # bdiff sometimes gives huge matches past eof, this check eats them,
130 # bdiff sometimes gives huge matches past eof, this check eats them,
137 # and deals with the special first match case described above
131 # and deals with the special first match case described above
138 if old or new:
132 if s[0] != s[1] or s[2] != s[3]:
139 type = '!'
133 type = '!'
140 if opts.ignoreblanklines:
134 if opts.ignoreblanklines:
141 cold = wsclean(opts, "".join(old))
135 if lines1 is None:
142 cnew = wsclean(opts, "".join(new))
136 lines1 = splitnewlines(text1)
143 if cold == cnew:
137 if lines2 is None:
138 lines2 = splitnewlines(text2)
139 old = wsclean(opts, "".join(lines1[s[0]:s[1]]))
140 new = wsclean(opts, "".join(lines2[s[2]:s[3]]))
141 if old == new:
144 type = '~'
142 type = '~'
145 yield s, type
143 yield s, type
146 yield s1, '='
144 yield s1, '='
General Comments 0
You need to be logged in to leave comments. Login now