equal
deleted
inserted
replaced
138 else: |
138 else: |
139 # Consume the matching lines |
139 # Consume the matching lines |
140 while i1 < e1 and lines1[i1] == 1 and lines2[i2] == 1: |
140 while i1 < e1 and lines1[i1] == 1 and lines2[i2] == 1: |
141 i1 += 1 |
141 i1 += 1 |
142 i2 += 1 |
142 i2 += 1 |
143 yield [base1 + s1, base1 + i1, base2 + s2, base2 + i2], btype |
143 yield (base1 + s1, base1 + i1, base2 + s2, base2 + i2), btype |
144 s1 = i1 |
144 s1 = i1 |
145 s2 = i2 |
145 s2 = i2 |
146 |
146 |
147 |
147 |
148 def hunkinrange(hunk, linerange): |
148 def hunkinrange(hunk, linerange): |
242 # in the file. If it starts later, old and new below will both be |
242 # in the file. If it starts later, old and new below will both be |
243 # empty and we'll continue to the next match. |
243 # empty and we'll continue to the next match. |
244 if i > 0: |
244 if i > 0: |
245 s = diff[i - 1] |
245 s = diff[i - 1] |
246 else: |
246 else: |
247 s = [0, 0, 0, 0] |
247 s = (0, 0, 0, 0) |
248 s = [s[1], s1[0], s[3], s1[2]] |
248 s = (s[1], s1[0], s[3], s1[2]) |
249 |
249 |
250 # bdiff sometimes gives huge matches past eof, this check eats them, |
250 # bdiff sometimes gives huge matches past eof, this check eats them, |
251 # and deals with the special first match case described above |
251 # and deals with the special first match case described above |
252 if s[0] != s[1] or s[2] != s[3]: |
252 if s[0] != s[1] or s[2] != s[3]: |
253 type = b'!' |
253 type = b'!' |
473 yield True |
473 yield True |
474 for x in yieldhunk(hunk): |
474 for x in yieldhunk(hunk): |
475 yield x |
475 yield x |
476 if prev: |
476 if prev: |
477 # we've joined the previous hunk, record the new ending points. |
477 # we've joined the previous hunk, record the new ending points. |
478 hunk[1] = a2 |
478 hunk = (hunk[0], a2, hunk[2], b2, hunk[4]) |
479 hunk[3] = b2 |
|
480 delta = hunk[4] |
479 delta = hunk[4] |
481 else: |
480 else: |
482 # create a new hunk |
481 # create a new hunk |
483 hunk = [astart, a2, bstart, b2, delta] |
482 hunk = (astart, a2, bstart, b2, delta) |
484 |
483 |
485 delta[len(delta) :] = [b' ' + x for x in l1[astart:a1]] |
484 delta[len(delta) :] = [b' ' + x for x in l1[astart:a1]] |
486 delta[len(delta) :] = [b'-' + x for x in old] |
485 delta[len(delta) :] = [b'-' + x for x in old] |
487 delta[len(delta) :] = [b'+' + x for x in new] |
486 delta[len(delta) :] = [b'+' + x for x in new] |
488 |
487 |