107 if name_b and end_marker: |
108 if name_b and end_marker: |
108 end_marker = end_marker + ' ' + name_b |
109 end_marker = end_marker + ' ' + name_b |
109 if name_base and base_marker: |
110 if name_base and base_marker: |
110 base_marker = base_marker + ' ' + name_base |
111 base_marker = base_marker + ' ' + name_base |
111 merge_regions = self.merge_regions() |
112 merge_regions = self.merge_regions() |
|
113 if minimize: |
|
114 merge_regions = self.minimize(merge_regions) |
112 for t in merge_regions: |
115 for t in merge_regions: |
113 what = t[0] |
116 what = t[0] |
114 if what == 'unchanged': |
117 if what == 'unchanged': |
115 for i in range(t[1], t[2]): |
118 for i in range(t[1], t[2]): |
116 yield self.base[i] |
119 yield self.base[i] |
439 out = opener(os.path.basename(local), "w", atomictemp=True) |
442 out = opener(os.path.basename(local), "w", atomictemp=True) |
440 else: |
443 else: |
441 out = sys.stdout |
444 out = sys.stdout |
442 |
445 |
443 m3 = Merge3Text(basetext, localtext, othertext) |
446 m3 = Merge3Text(basetext, localtext, othertext) |
444 extrakwargs = {"localorother": opts.get("localorother", None)} |
447 extrakwargs = { |
|
448 "localorother": opts.get("localorother", None), |
|
449 'minimize': True, |
|
450 } |
445 if mode == 'union': |
451 if mode == 'union': |
446 extrakwargs['start_marker'] = None |
452 extrakwargs['start_marker'] = None |
447 extrakwargs['mid_marker'] = None |
453 extrakwargs['mid_marker'] = None |
448 extrakwargs['end_marker'] = None |
454 extrakwargs['end_marker'] = None |
449 elif name_base is not None: |
455 elif name_base is not None: |
450 extrakwargs['base_marker'] = '|||||||' |
456 extrakwargs['base_marker'] = '|||||||' |
451 extrakwargs['name_base'] = name_base |
457 extrakwargs['name_base'] = name_base |
|
458 extrakwargs['minimize'] = False |
452 for line in m3.merge_lines(name_a=name_a, name_b=name_b, **extrakwargs): |
459 for line in m3.merge_lines(name_a=name_a, name_b=name_b, **extrakwargs): |
453 out.write(line) |
460 out.write(line) |
454 |
461 |
455 if not opts.get('print'): |
462 if not opts.get('print'): |
456 out.close() |
463 out.close() |