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