Show More
@@ -354,11 +354,9 b' def render_markers(' | |||
|
354 | 354 | m3, |
|
355 | 355 | name_a=None, |
|
356 | 356 | name_b=None, |
|
357 | name_base=None, | |
|
358 | 357 | start_marker=b'<<<<<<<', |
|
359 | 358 | mid_marker=b'=======', |
|
360 | 359 | end_marker=b'>>>>>>>', |
|
361 | base_marker=None, | |
|
362 | 360 | minimize=False, |
|
363 | 361 | ): |
|
364 | 362 | """Return merge in cvs-like form.""" |
@@ -368,8 +366,6 b' def render_markers(' | |||
|
368 | 366 | start_marker = start_marker + b' ' + name_a |
|
369 | 367 | if name_b and end_marker: |
|
370 | 368 | end_marker = end_marker + b' ' + name_b |
|
371 | if name_base and base_marker: | |
|
372 | base_marker = base_marker + b' ' + name_base | |
|
373 | 369 | merge_groups = m3.merge_groups() |
|
374 | 370 | if minimize: |
|
375 | 371 | merge_groups = m3.minimize(merge_groups) |
@@ -381,9 +377,6 b' def render_markers(' | |||
|
381 | 377 | if start_marker is not None: |
|
382 | 378 | lines.append(start_marker + newline) |
|
383 | 379 | lines.extend(a_lines) |
|
384 | if base_marker is not None: | |
|
385 | lines.append(base_marker + newline) | |
|
386 | lines.extend(base_lines) | |
|
387 | 380 | if mid_marker is not None: |
|
388 | 381 | lines.append(mid_marker + newline) |
|
389 | 382 | lines.extend(b_lines) |
@@ -394,7 +387,29 b' def render_markers(' | |||
|
394 | 387 | return lines, conflicts |
|
395 | 388 | |
|
396 | 389 | |
|
390 | def render_merge3(m3, name_a, name_b, name_base): | |
|
391 | """Render conflicts as 3-way conflict markers.""" | |
|
392 | newline = _detect_newline(m3) | |
|
393 | conflicts = False | |
|
394 | lines = [] | |
|
395 | for what, group_lines in m3.merge_groups(): | |
|
396 | if what == b'conflict': | |
|
397 | base_lines, a_lines, b_lines = group_lines | |
|
398 | conflicts = True | |
|
399 | lines.append(b'<<<<<<< ' + name_a + newline) | |
|
400 | lines.extend(a_lines) | |
|
401 | lines.append(b'||||||| ' + name_base + newline) | |
|
402 | lines.extend(base_lines) | |
|
403 | lines.append(b'=======' + newline) | |
|
404 | lines.extend(b_lines) | |
|
405 | lines.append(b'>>>>>>> ' + name_b + newline) | |
|
406 | else: | |
|
407 | lines.extend(group_lines) | |
|
408 | return lines, conflicts | |
|
409 | ||
|
410 | ||
|
397 | 411 | def render_mergediff(m3, name_a, name_b, name_base): |
|
412 | """Render conflicts as conflict markers with one snapshot and one diff.""" | |
|
398 | 413 | newline = _detect_newline(m3) |
|
399 | 414 | lines = [] |
|
400 | 415 | conflicts = False |
@@ -504,14 +519,12 b' def simplemerge(ui, localctx, basectx, o' | |||
|
504 | 519 | name_a, name_b, name_base = _picklabels(opts.get('label', [])) |
|
505 | 520 | if mode == b'mergediff': |
|
506 | 521 | lines, conflicts = render_mergediff(m3, name_a, name_b, name_base) |
|
522 | elif mode == b'merge3': | |
|
523 | lines, conflicts = render_merge3(m3, name_a, name_b, name_base) | |
|
507 | 524 | else: |
|
508 | 525 | extrakwargs = { |
|
509 | 526 | 'minimize': True, |
|
510 | 527 | } |
|
511 | if mode == b'merge3': | |
|
512 | extrakwargs['base_marker'] = b'|||||||' | |
|
513 | extrakwargs['name_base'] = name_base | |
|
514 | extrakwargs['minimize'] = False | |
|
515 | 528 | lines, conflicts = render_markers( |
|
516 | 529 | m3, name_a=name_a, name_b=name_b, **extrakwargs |
|
517 | 530 | ) |
General Comments 0
You need to be logged in to leave comments.
Login now