Show More
@@ -402,31 +402,6 b' class Merge3Text(object):' | |||
|
402 | 402 | |
|
403 | 403 | return sl |
|
404 | 404 | |
|
405 | def find_unconflicted(self): | |
|
406 | """Return a list of ranges in base that are not conflicted.""" | |
|
407 | am = mdiff.get_matching_blocks(self.basetext, self.atext) | |
|
408 | bm = mdiff.get_matching_blocks(self.basetext, self.btext) | |
|
409 | ||
|
410 | unc = [] | |
|
411 | ||
|
412 | while am and bm: | |
|
413 | # there is an unconflicted block at i; how long does it | |
|
414 | # extend? until whichever one ends earlier. | |
|
415 | a1 = am[0][0] | |
|
416 | a2 = a1 + am[0][2] | |
|
417 | b1 = bm[0][0] | |
|
418 | b2 = b1 + bm[0][2] | |
|
419 | i = intersect((a1, a2), (b1, b2)) | |
|
420 | if i: | |
|
421 | unc.append(i) | |
|
422 | ||
|
423 | if a2 < b2: | |
|
424 | del am[0] | |
|
425 | else: | |
|
426 | del bm[0] | |
|
427 | ||
|
428 | return unc | |
|
429 | ||
|
430 | 405 | |
|
431 | 406 | def _verifytext(text, path, ui, opts): |
|
432 | 407 | """verifies that text is non-binary (unless opts[text] is passed, |
@@ -141,8 +141,6 b' class TestMerge3(TestCase):' | |||
|
141 | 141 | """No conflicts because nothing changed""" |
|
142 | 142 | m3 = Merge3([b'aaa', b'bbb'], [b'aaa', b'bbb'], [b'aaa', b'bbb']) |
|
143 | 143 | |
|
144 | self.assertEqual(m3.find_unconflicted(), [(0, 2)]) | |
|
145 | ||
|
146 | 144 | self.assertEqual( |
|
147 | 145 | list(m3.find_sync_regions()), |
|
148 | 146 | [(0, 2, 0, 2, 0, 2), (2, 2, 2, 2, 2, 2)], |
@@ -189,8 +187,6 b' class TestMerge3(TestCase):' | |||
|
189 | 187 | [b'aaa', b'bbb'], [b'aaa', b'111', b'bbb'], [b'aaa', b'bbb'] |
|
190 | 188 | ) |
|
191 | 189 | |
|
192 | self.assertEqual(m3.find_unconflicted(), [(0, 1), (1, 2)]) | |
|
193 | ||
|
194 | 190 | self.assertEqual( |
|
195 | 191 | list(m3.find_sync_regions()), |
|
196 | 192 | [(0, 1, 0, 1, 0, 1), (1, 2, 2, 3, 1, 2), (2, 2, 3, 3, 2, 2)], |
@@ -271,8 +267,6 b' class TestMerge3(TestCase):' | |||
|
271 | 267 | [b'aaa\n', b'222\n', b'bbb\n'], |
|
272 | 268 | ) |
|
273 | 269 | |
|
274 | self.assertEqual(m3.find_unconflicted(), [(0, 1), (1, 2)]) | |
|
275 | ||
|
276 | 270 | self.assertEqual( |
|
277 | 271 | list(m3.find_sync_regions()), |
|
278 | 272 | [(0, 1, 0, 1, 0, 1), (1, 2, 2, 3, 2, 3), (2, 2, 3, 3, 3, 3)], |
@@ -323,8 +317,6 b' bbb' | |||
|
323 | 317 | [b'aaa', b'222', b'bbb'], |
|
324 | 318 | ) |
|
325 | 319 | |
|
326 | self.assertEqual(m3.find_unconflicted(), [(0, 1), (2, 3)]) | |
|
327 | ||
|
328 | 320 | self.assertEqual( |
|
329 | 321 | list(m3.find_sync_regions()), |
|
330 | 322 | [(0, 1, 0, 1, 0, 1), (2, 3, 2, 3, 2, 3), (3, 3, 3, 3, 3, 3)], |
@@ -338,8 +330,6 b' bbb' | |||
|
338 | 330 | [b'aaa', b'222', b'222', b'222', b'222', b'bbb'], |
|
339 | 331 | ) |
|
340 | 332 | |
|
341 | self.assertEqual(m3.find_unconflicted(), [(0, 1), (3, 4)]) | |
|
342 | ||
|
343 | 333 | self.assertEqual( |
|
344 | 334 | list(m3.find_sync_regions()), |
|
345 | 335 | [(0, 1, 0, 1, 0, 1), (3, 4, 4, 5, 5, 6), (4, 4, 5, 5, 6, 6)], |
General Comments 0
You need to be logged in to leave comments.
Login now