Show More
@@ -484,6 +484,17 b' def _mergediff(m3, name_a, name_b, name_' | |||
|
484 | 484 | return lines, conflicts |
|
485 | 485 | |
|
486 | 486 | |
|
487 | def _resolve(m3, sides): | |
|
488 | lines = [] | |
|
489 | for group in m3.merge_groups(): | |
|
490 | if group[0] == b'conflict': | |
|
491 | for side in sides: | |
|
492 | lines.extend(group[side + 1]) | |
|
493 | else: | |
|
494 | lines.extend(group[1]) | |
|
495 | return lines | |
|
496 | ||
|
497 | ||
|
487 | 498 | def simplemerge(ui, localctx, basectx, otherctx, **opts): |
|
488 | 499 | """Performs the simplemerge algorithm. |
|
489 | 500 | |
@@ -515,30 +526,27 b' def simplemerge(ui, localctx, basectx, o' | |||
|
515 | 526 | return 1 |
|
516 | 527 | |
|
517 | 528 | m3 = Merge3Text(basetext, localtext, othertext) |
|
529 | conflicts = False | |
|
530 | if mode == b'union': | |
|
531 | lines = _resolve(m3, (1, 2)) | |
|
532 | elif mode == b'local': | |
|
533 | lines = _resolve(m3, (1,)) | |
|
534 | elif mode == b'other': | |
|
535 | lines = _resolve(m3, (2,)) | |
|
536 | elif mode == b'mergediff': | |
|
537 | lines, conflicts = _mergediff(m3, name_a, name_b, name_base) | |
|
538 | else: | |
|
518 | 539 | extrakwargs = { |
|
519 | "localorother": None, | |
|
520 | 540 | 'minimize': True, |
|
521 | 541 | } |
|
522 | if mode == b'union': | |
|
523 | extrakwargs['start_marker'] = None | |
|
524 | extrakwargs['mid_marker'] = None | |
|
525 | extrakwargs['end_marker'] = None | |
|
526 | elif mode == b'local': | |
|
527 | extrakwargs['localorother'] = b'local' | |
|
528 | elif mode == b'other': | |
|
529 | extrakwargs['localorother'] = b'other' | |
|
530 | elif name_base is not None: | |
|
542 | if name_base is not None: | |
|
531 | 543 | extrakwargs['base_marker'] = b'|||||||' |
|
532 | 544 | extrakwargs['name_base'] = name_base |
|
533 | 545 | extrakwargs['minimize'] = False |
|
534 | ||
|
535 | if mode == b'mergediff': | |
|
536 | lines, conflicts = _mergediff(m3, name_a, name_b, name_base) | |
|
537 | else: | |
|
538 | 546 | lines = list( |
|
539 | 547 | m3.merge_lines(name_a=name_a, name_b=name_b, **extrakwargs) |
|
540 | 548 | ) |
|
541 |
conflicts = m3.conflicts |
|
|
549 | conflicts = m3.conflicts | |
|
542 | 550 | |
|
543 | 551 | mergedtext = b''.join(lines) |
|
544 | 552 | if opts.get('print'): |
General Comments 0
You need to be logged in to leave comments.
Login now