287
287
# Do not emit regions which match, only regions which do not match
288
288
matches = bzrlib.patiencediff.PatienceSequenceMatcher(None,
289
289
self.base[zstart:zend], self.b[bstart:bend]).get_matching_blocks()
292
293
yielded_a = False
293
for region_iz, region_ib, region_len in matches:
294
conflict_z_len = region_iz - zzcur
295
conflict_b_len = region_ib - bbcur
294
for base_idx, b_idx, match_len in matches:
295
conflict_z_len = base_idx - last_base_idx
296
conflict_b_len = b_idx - last_b_idx
296
297
if conflict_b_len == 0: # There are no lines in b which conflict,
301
yield ('conflict', zstart + zzcur, zstart + region_iz,
302
aend, aend, bstart + bbcur, bstart + region_ib)
303
zstart + last_base_idx, zstart + base_idx,
304
aend, aend, bstart + last_b_idx, bstart + b_idx)
304
306
# The first conflict gets the a-range
306
yield ('conflict', zstart + zzcur, zstart + region_iz,
307
astart, aend, bstart + bbcur, bstart + region_ib)
308
zzcur = region_iz + region_len
309
bbcur = region_ib + region_len
310
if zzcur != zend - zstart or bbcur != bend - bstart:
308
yield ('conflict', zstart + last_base_idx, zstart +
310
astart, aend, bstart + last_b_idx, bstart + b_idx)
311
last_base_idx = base_idx + match_len
312
last_b_idx = b_idx + match_len
313
if last_base_idx != zend - zstart or last_b_idx != bend - bstart:
312
yield ('conflict', zstart + zzcur, zstart + region_iz,
313
aend, aend, bstart + bbcur, bstart + region_ib)
315
yield ('conflict', zstart + last_base_idx, zstart + base_idx,
316
aend, aend, bstart + last_b_idx, bstart + b_idx)
315
318
# The first conflict gets the a-range
317
yield ('conflict', zstart + zzcur, zstart + region_iz,
318
astart, aend, bstart + bbcur, bstart + region_ib)
320
yield ('conflict', zstart + last_base_idx, zstart + base_idx,
321
astart, aend, bstart + last_b_idx, bstart + b_idx)
319
322
if not yielded_a:
320
323
yield ('conflict', zstart, zend, astart, aend, bstart, bend)