Show More
@@ -306,27 +306,27 b' def _matcheol(file, backup):' | |||||
306 |
|
306 | |||
307 |
|
307 | |||
308 | @internaltool(b'prompt', nomerge) |
|
308 | @internaltool(b'prompt', nomerge) | |
309 |
def _iprompt(repo, mynode, |
|
309 | def _iprompt(repo, mynode, local, other, base, toolconf): | |
310 | """Asks the user which of the local `p1()` or the other `p2()` version to |
|
310 | """Asks the user which of the local `p1()` or the other `p2()` version to | |
311 | keep as the merged version.""" |
|
311 | keep as the merged version.""" | |
312 | ui = repo.ui |
|
312 | ui = repo.ui | |
313 |
fd = |
|
313 | fd = local.fctx.path() | |
314 | uipathfn = scmutil.getuipathfn(repo) |
|
314 | uipathfn = scmutil.getuipathfn(repo) | |
315 |
|
315 | |||
316 | # Avoid prompting during an in-memory merge since it doesn't support merge |
|
316 | # Avoid prompting during an in-memory merge since it doesn't support merge | |
317 | # conflicts. |
|
317 | # conflicts. | |
318 |
if |
|
318 | if local.fctx.changectx().isinmemory(): | |
319 | raise error.InMemoryMergeConflictsError( |
|
319 | raise error.InMemoryMergeConflictsError( | |
320 | b'in-memory merge does not support file conflicts' |
|
320 | b'in-memory merge does not support file conflicts' | |
321 | ) |
|
321 | ) | |
322 |
|
322 | |||
323 |
prompts = partextras( |
|
323 | prompts = partextras([local.label, other.label]) | |
324 | prompts[b'fd'] = uipathfn(fd) |
|
324 | prompts[b'fd'] = uipathfn(fd) | |
325 | try: |
|
325 | try: | |
326 |
if |
|
326 | if other.fctx.isabsent(): | |
327 | index = ui.promptchoice(_localchangedotherdeletedmsg % prompts, 2) |
|
327 | index = ui.promptchoice(_localchangedotherdeletedmsg % prompts, 2) | |
328 | choice = [b'local', b'other', b'unresolved'][index] |
|
328 | choice = [b'local', b'other', b'unresolved'][index] | |
329 |
elif |
|
329 | elif local.fctx.isabsent(): | |
330 | index = ui.promptchoice(_otherchangedlocaldeletedmsg % prompts, 2) |
|
330 | index = ui.promptchoice(_otherchangedlocaldeletedmsg % prompts, 2) | |
331 | choice = [b'other', b'local', b'unresolved'][index] |
|
331 | choice = [b'other', b'local', b'unresolved'][index] | |
332 | else: |
|
332 | else: | |
@@ -347,44 +347,48 b' def _iprompt(repo, mynode, fcd, fco, fca' | |||||
347 | choice = [b'local', b'other', b'unresolved'][index] |
|
347 | choice = [b'local', b'other', b'unresolved'][index] | |
348 |
|
348 | |||
349 | if choice == b'other': |
|
349 | if choice == b'other': | |
350 |
return _iother(repo, mynode, |
|
350 | return _iother(repo, mynode, local, other, base, toolconf) | |
351 | elif choice == b'local': |
|
351 | elif choice == b'local': | |
352 |
return _ilocal(repo, mynode, |
|
352 | return _ilocal(repo, mynode, local, other, base, toolconf) | |
353 | elif choice == b'unresolved': |
|
353 | elif choice == b'unresolved': | |
354 |
return _ifail(repo, mynode, |
|
354 | return _ifail(repo, mynode, local, other, base, toolconf) | |
355 | except error.ResponseExpected: |
|
355 | except error.ResponseExpected: | |
356 | ui.write(b"\n") |
|
356 | ui.write(b"\n") | |
357 |
return _ifail(repo, mynode, |
|
357 | return _ifail(repo, mynode, local, other, base, toolconf) | |
358 |
|
358 | |||
359 |
|
359 | |||
360 | @internaltool(b'local', nomerge) |
|
360 | @internaltool(b'local', nomerge) | |
361 |
def _ilocal(repo, mynode, |
|
361 | def _ilocal(repo, mynode, local, other, base, toolconf): | |
362 | """Uses the local `p1()` version of files as the merged version.""" |
|
362 | """Uses the local `p1()` version of files as the merged version.""" | |
363 |
return 0, |
|
363 | return 0, local.fctx.isabsent() | |
364 |
|
364 | |||
365 |
|
365 | |||
366 | @internaltool(b'other', nomerge) |
|
366 | @internaltool(b'other', nomerge) | |
367 |
def _iother(repo, mynode, |
|
367 | def _iother(repo, mynode, local, other, base, toolconf): | |
368 | """Uses the other `p2()` version of files as the merged version.""" |
|
368 | """Uses the other `p2()` version of files as the merged version.""" | |
369 |
if |
|
369 | if other.fctx.isabsent(): | |
370 | # local changed, remote deleted -- 'deleted' picked |
|
370 | # local changed, remote deleted -- 'deleted' picked | |
371 |
_underlyingfctxifabsent( |
|
371 | _underlyingfctxifabsent(local.fctx).remove() | |
372 | deleted = True |
|
372 | deleted = True | |
373 | else: |
|
373 | else: | |
374 |
_underlyingfctxifabsent( |
|
374 | _underlyingfctxifabsent(local.fctx).write( | |
|
375 | other.fctx.data(), other.fctx.flags() | |||
|
376 | ) | |||
375 | deleted = False |
|
377 | deleted = False | |
376 | return 0, deleted |
|
378 | return 0, deleted | |
377 |
|
379 | |||
378 |
|
380 | |||
379 | @internaltool(b'fail', nomerge) |
|
381 | @internaltool(b'fail', nomerge) | |
380 |
def _ifail(repo, mynode, |
|
382 | def _ifail(repo, mynode, local, other, base, toolconf): | |
381 | """ |
|
383 | """ | |
382 | Rather than attempting to merge files that were modified on both |
|
384 | Rather than attempting to merge files that were modified on both | |
383 | branches, it marks them as unresolved. The resolve command must be |
|
385 | branches, it marks them as unresolved. The resolve command must be | |
384 | used to resolve these conflicts.""" |
|
386 | used to resolve these conflicts.""" | |
385 | # for change/delete conflicts write out the changed version, then fail |
|
387 | # for change/delete conflicts write out the changed version, then fail | |
386 |
if |
|
388 | if local.fctx.isabsent(): | |
387 |
_underlyingfctxifabsent( |
|
389 | _underlyingfctxifabsent(local.fctx).write( | |
|
390 | other.fctx.data(), other.fctx.flags() | |||
|
391 | ) | |||
388 | return 1, False |
|
392 | return 1, False | |
389 |
|
393 | |||
390 |
|
394 | |||
@@ -399,9 +403,9 b' def _underlyingfctxifabsent(filectx):' | |||||
399 | return filectx |
|
403 | return filectx | |
400 |
|
404 | |||
401 |
|
405 | |||
402 |
def _premerge(repo, |
|
406 | def _premerge(repo, local, other, base, toolconf, backup): | |
403 | tool, toolpath, binary, symlink, scriptfn = toolconf |
|
407 | tool, toolpath, binary, symlink, scriptfn = toolconf | |
404 |
if symlink or |
|
408 | if symlink or local.fctx.isabsent() or other.fctx.isabsent(): | |
405 | return 1 |
|
409 | return 1 | |
406 |
|
410 | |||
407 | ui = repo.ui |
|
411 | ui = repo.ui | |
@@ -426,9 +430,6 b' def _premerge(repo, fcd, fco, fca, toolc' | |||||
426 | mode = b'mergediff' |
|
430 | mode = b'mergediff' | |
427 | elif premerge == b'keep-merge3': |
|
431 | elif premerge == b'keep-merge3': | |
428 | mode = b'merge3' |
|
432 | mode = b'merge3' | |
429 | local = simplemerge.MergeInput(fcd, labels[0]) |
|
|||
430 | other = simplemerge.MergeInput(fco, labels[1]) |
|
|||
431 | base = simplemerge.MergeInput(fca, labels[2]) |
|
|||
432 | r = simplemerge.simplemerge( |
|
433 | r = simplemerge.simplemerge( | |
433 | ui, local, base, other, quiet=True, mode=mode |
|
434 | ui, local, base, other, quiet=True, mode=mode | |
434 | ) |
|
435 | ) | |
@@ -437,7 +438,7 b' def _premerge(repo, fcd, fco, fca, toolc' | |||||
437 | return 0 |
|
438 | return 0 | |
438 | if premerge not in validkeep: |
|
439 | if premerge not in validkeep: | |
439 | # restore from backup and try again |
|
440 | # restore from backup and try again | |
440 |
_restorebackup( |
|
441 | _restorebackup(local.fctx, backup) | |
441 | return 1 # continue merging |
|
442 | return 1 # continue merging | |
442 |
|
443 | |||
443 |
|
444 | |||
@@ -462,7 +463,7 b' def _mergecheck(repo, mynode, fcd, fco, ' | |||||
462 | return True |
|
463 | return True | |
463 |
|
464 | |||
464 |
|
465 | |||
465 |
def _merge(repo, |
|
466 | def _merge(repo, local, other, base, mode): | |
466 | """ |
|
467 | """ | |
467 | Uses the internal non-interactive simple merge algorithm for merging |
|
468 | Uses the internal non-interactive simple merge algorithm for merging | |
468 | files. It will fail if there are any conflicts and leave markers in |
|
469 | files. It will fail if there are any conflicts and leave markers in | |
@@ -470,12 +471,6 b' def _merge(repo, fcd, fco, fca, labels, ' | |||||
470 | of merge, unless mode equals 'union' which suppresses the markers.""" |
|
471 | of merge, unless mode equals 'union' which suppresses the markers.""" | |
471 | ui = repo.ui |
|
472 | ui = repo.ui | |
472 |
|
473 | |||
473 | local = simplemerge.MergeInput(fcd) |
|
|||
474 | local.label = labels[0] |
|
|||
475 | other = simplemerge.MergeInput(fco) |
|
|||
476 | other.label = labels[1] |
|
|||
477 | base = simplemerge.MergeInput(fca) |
|
|||
478 | base.label = labels[2] |
|
|||
479 | r = simplemerge.simplemerge(ui, local, base, other, mode=mode) |
|
474 | r = simplemerge.simplemerge(ui, local, base, other, mode=mode) | |
480 | return True, r, False |
|
475 | return True, r, False | |
481 |
|
476 | |||
@@ -489,12 +484,12 b' def _merge(repo, fcd, fco, fca, labels, ' | |||||
489 | ), |
|
484 | ), | |
490 | precheck=_mergecheck, |
|
485 | precheck=_mergecheck, | |
491 | ) |
|
486 | ) | |
492 |
def _iunion(repo, mynode, |
|
487 | def _iunion(repo, mynode, local, other, base, toolconf, backup): | |
493 | """ |
|
488 | """ | |
494 | Uses the internal non-interactive simple merge algorithm for merging |
|
489 | Uses the internal non-interactive simple merge algorithm for merging | |
495 | files. It will use both left and right sides for conflict regions. |
|
490 | files. It will use both left and right sides for conflict regions. | |
496 | No markers are inserted.""" |
|
491 | No markers are inserted.""" | |
497 |
return _merge(repo, |
|
492 | return _merge(repo, local, other, base, b'union') | |
498 |
|
493 | |||
499 |
|
494 | |||
500 | @internaltool( |
|
495 | @internaltool( | |
@@ -506,13 +501,13 b' def _iunion(repo, mynode, fcd, fco, fca,' | |||||
506 | ), |
|
501 | ), | |
507 | precheck=_mergecheck, |
|
502 | precheck=_mergecheck, | |
508 | ) |
|
503 | ) | |
509 |
def _imerge(repo, mynode, |
|
504 | def _imerge(repo, mynode, local, other, base, toolconf, backup): | |
510 | """ |
|
505 | """ | |
511 | Uses the internal non-interactive simple merge algorithm for merging |
|
506 | Uses the internal non-interactive simple merge algorithm for merging | |
512 | files. It will fail if there are any conflicts and leave markers in |
|
507 | files. It will fail if there are any conflicts and leave markers in | |
513 | the partially merged file. Markers will have two sections, one for each side |
|
508 | the partially merged file. Markers will have two sections, one for each side | |
514 | of merge.""" |
|
509 | of merge.""" | |
515 |
return _merge(repo, |
|
510 | return _merge(repo, local, other, base, b'merge') | |
516 |
|
511 | |||
517 |
|
512 | |||
518 | @internaltool( |
|
513 | @internaltool( | |
@@ -524,13 +519,13 b' def _imerge(repo, mynode, fcd, fco, fca,' | |||||
524 | ), |
|
519 | ), | |
525 | precheck=_mergecheck, |
|
520 | precheck=_mergecheck, | |
526 | ) |
|
521 | ) | |
527 |
def _imerge3(repo, mynode, |
|
522 | def _imerge3(repo, mynode, local, other, base, toolconf, backup): | |
528 | """ |
|
523 | """ | |
529 | Uses the internal non-interactive simple merge algorithm for merging |
|
524 | Uses the internal non-interactive simple merge algorithm for merging | |
530 | files. It will fail if there are any conflicts and leave markers in |
|
525 | files. It will fail if there are any conflicts and leave markers in | |
531 | the partially merged file. Marker will have three sections, one from each |
|
526 | the partially merged file. Marker will have three sections, one from each | |
532 | side of the merge and one for the base content.""" |
|
527 | side of the merge and one for the base content.""" | |
533 |
return _merge(repo, |
|
528 | return _merge(repo, local, other, base, b'merge3') | |
534 |
|
529 | |||
535 |
|
530 | |||
536 | @internaltool( |
|
531 | @internaltool( | |
@@ -561,30 +556,30 b' def _imerge3alwaysgood(*args, **kwargs):' | |||||
561 | ), |
|
556 | ), | |
562 | precheck=_mergecheck, |
|
557 | precheck=_mergecheck, | |
563 | ) |
|
558 | ) | |
564 |
def _imerge_diff(repo, mynode, |
|
559 | def _imerge_diff(repo, mynode, local, other, base, toolconf, backup): | |
565 | """ |
|
560 | """ | |
566 | Uses the internal non-interactive simple merge algorithm for merging |
|
561 | Uses the internal non-interactive simple merge algorithm for merging | |
567 | files. It will fail if there are any conflicts and leave markers in |
|
562 | files. It will fail if there are any conflicts and leave markers in | |
568 | the partially merged file. The marker will have two sections, one with the |
|
563 | the partially merged file. The marker will have two sections, one with the | |
569 | content from one side of the merge, and one with a diff from the base |
|
564 | content from one side of the merge, and one with a diff from the base | |
570 | content to the content on the other side. (experimental)""" |
|
565 | content to the content on the other side. (experimental)""" | |
571 |
return _merge(repo, |
|
566 | return _merge(repo, local, other, base, b'mergediff') | |
572 |
|
567 | |||
573 |
|
568 | |||
574 | @internaltool(b'merge-local', mergeonly, precheck=_mergecheck) |
|
569 | @internaltool(b'merge-local', mergeonly, precheck=_mergecheck) | |
575 |
def _imergelocal(repo, mynode, |
|
570 | def _imergelocal(repo, mynode, local, other, base, toolconf, backup): | |
576 | """ |
|
571 | """ | |
577 | Like :merge, but resolve all conflicts non-interactively in favor |
|
572 | Like :merge, but resolve all conflicts non-interactively in favor | |
578 | of the local `p1()` changes.""" |
|
573 | of the local `p1()` changes.""" | |
579 |
return _merge(repo, |
|
574 | return _merge(repo, local, other, base, b'local') | |
580 |
|
575 | |||
581 |
|
576 | |||
582 | @internaltool(b'merge-other', mergeonly, precheck=_mergecheck) |
|
577 | @internaltool(b'merge-other', mergeonly, precheck=_mergecheck) | |
583 |
def _imergeother(repo, mynode, |
|
578 | def _imergeother(repo, mynode, local, other, base, toolconf, backup): | |
584 | """ |
|
579 | """ | |
585 | Like :merge, but resolve all conflicts non-interactively in favor |
|
580 | Like :merge, but resolve all conflicts non-interactively in favor | |
586 | of the other `p2()` changes.""" |
|
581 | of the other `p2()` changes.""" | |
587 |
return _merge(repo, |
|
582 | return _merge(repo, local, other, base, b'other') | |
588 |
|
583 | |||
589 |
|
584 | |||
590 | @internaltool( |
|
585 | @internaltool( | |
@@ -596,16 +591,16 b' def _imergeother(repo, mynode, fcd, fco,' | |||||
596 | b"tool of your choice)\n" |
|
591 | b"tool of your choice)\n" | |
597 | ), |
|
592 | ), | |
598 | ) |
|
593 | ) | |
599 |
def _itagmerge(repo, mynode, |
|
594 | def _itagmerge(repo, mynode, local, other, base, toolconf, backup): | |
600 | """ |
|
595 | """ | |
601 | Uses the internal tag merge algorithm (experimental). |
|
596 | Uses the internal tag merge algorithm (experimental). | |
602 | """ |
|
597 | """ | |
603 |
success, status = tagmerge.merge(repo, |
|
598 | success, status = tagmerge.merge(repo, local.fctx, other.fctx, base.fctx) | |
604 | return success, status, False |
|
599 | return success, status, False | |
605 |
|
600 | |||
606 |
|
601 | |||
607 | @internaltool(b'dump', fullmerge, binary=True, symlink=True) |
|
602 | @internaltool(b'dump', fullmerge, binary=True, symlink=True) | |
608 |
def _idump(repo, mynode, |
|
603 | def _idump(repo, mynode, local, other, base, toolconf, backup): | |
609 | """ |
|
604 | """ | |
610 | Creates three versions of the files to merge, containing the |
|
605 | Creates three versions of the files to merge, containing the | |
611 | contents of local, other and base. These files can then be used to |
|
606 | contents of local, other and base. These files can then be used to | |
@@ -617,31 +612,31 b' def _idump(repo, mynode, fcd, fco, fca, ' | |||||
617 | This implies premerge. Therefore, files aren't dumped, if premerge |
|
612 | This implies premerge. Therefore, files aren't dumped, if premerge | |
618 | runs successfully. Use :forcedump to forcibly write files out. |
|
613 | runs successfully. Use :forcedump to forcibly write files out. | |
619 | """ |
|
614 | """ | |
620 |
a = _workingpath(repo, |
|
615 | a = _workingpath(repo, local.fctx) | |
621 |
fd = |
|
616 | fd = local.fctx.path() | |
622 |
|
617 | |||
623 | from . import context |
|
618 | from . import context | |
624 |
|
619 | |||
625 |
if isinstance( |
|
620 | if isinstance(local.fctx, context.overlayworkingfilectx): | |
626 | raise error.InMemoryMergeConflictsError( |
|
621 | raise error.InMemoryMergeConflictsError( | |
627 | b'in-memory merge does not support the :dump tool.' |
|
622 | b'in-memory merge does not support the :dump tool.' | |
628 | ) |
|
623 | ) | |
629 |
|
624 | |||
630 |
util.writefile(a + b".local", |
|
625 | util.writefile(a + b".local", local.fctx.decodeddata()) | |
631 |
repo.wwrite(fd + b".other", |
|
626 | repo.wwrite(fd + b".other", other.fctx.data(), other.fctx.flags()) | |
632 |
repo.wwrite(fd + b".base", |
|
627 | repo.wwrite(fd + b".base", base.fctx.data(), base.fctx.flags()) | |
633 | return False, 1, False |
|
628 | return False, 1, False | |
634 |
|
629 | |||
635 |
|
630 | |||
636 | @internaltool(b'forcedump', mergeonly, binary=True, symlink=True) |
|
631 | @internaltool(b'forcedump', mergeonly, binary=True, symlink=True) | |
637 |
def _forcedump(repo, mynode, |
|
632 | def _forcedump(repo, mynode, local, other, base, toolconf, backup): | |
638 | """ |
|
633 | """ | |
639 | Creates three versions of the files as same as :dump, but omits premerge. |
|
634 | Creates three versions of the files as same as :dump, but omits premerge. | |
640 | """ |
|
635 | """ | |
641 |
return _idump(repo, mynode, |
|
636 | return _idump(repo, mynode, local, other, base, toolconf, backup) | |
642 |
|
637 | |||
643 |
|
638 | |||
644 |
def _xmergeimm(repo, mynode, |
|
639 | def _xmergeimm(repo, mynode, local, other, base, toolconf, backup): | |
645 | # In-memory merge simply raises an exception on all external merge tools, |
|
640 | # In-memory merge simply raises an exception on all external merge tools, | |
646 | # for now. |
|
641 | # for now. | |
647 | # |
|
642 | # | |
@@ -709,7 +704,10 b' def _describemerge(ui, repo, mynode, fcl' | |||||
709 | ui.status(t.renderdefault(props)) |
|
704 | ui.status(t.renderdefault(props)) | |
710 |
|
705 | |||
711 |
|
706 | |||
712 |
def _xmerge(repo, mynode, |
|
707 | def _xmerge(repo, mynode, local, other, base, toolconf, backup): | |
|
708 | fcd = local.fctx | |||
|
709 | fco = other.fctx | |||
|
710 | fca = base.fctx | |||
713 | tool, toolpath, binary, symlink, scriptfn = toolconf |
|
711 | tool, toolpath, binary, symlink, scriptfn = toolconf | |
714 | uipathfn = scmutil.getuipathfn(repo) |
|
712 | uipathfn = scmutil.getuipathfn(repo) | |
715 | if fcd.isabsent() or fco.isabsent(): |
|
713 | if fcd.isabsent() or fco.isabsent(): | |
@@ -726,8 +724,6 b' def _xmerge(repo, mynode, fcd, fco, fca,' | |||||
726 | ) as temppaths: |
|
724 | ) as temppaths: | |
727 | basepath, otherpath, localoutputpath = temppaths |
|
725 | basepath, otherpath, localoutputpath = temppaths | |
728 | outpath = b"" |
|
726 | outpath = b"" | |
729 | mylabel, otherlabel = labels[:2] |
|
|||
730 | baselabel = labels[2] |
|
|||
731 | env = { |
|
727 | env = { | |
732 | b'HG_FILE': fcd.path(), |
|
728 | b'HG_FILE': fcd.path(), | |
733 | b'HG_MY_NODE': short(mynode), |
|
729 | b'HG_MY_NODE': short(mynode), | |
@@ -736,9 +732,9 b' def _xmerge(repo, mynode, fcd, fco, fca,' | |||||
736 | b'HG_MY_ISLINK': b'l' in fcd.flags(), |
|
732 | b'HG_MY_ISLINK': b'l' in fcd.flags(), | |
737 | b'HG_OTHER_ISLINK': b'l' in fco.flags(), |
|
733 | b'HG_OTHER_ISLINK': b'l' in fco.flags(), | |
738 | b'HG_BASE_ISLINK': b'l' in fca.flags(), |
|
734 | b'HG_BASE_ISLINK': b'l' in fca.flags(), | |
739 |
b'HG_MY_LABEL': |
|
735 | b'HG_MY_LABEL': local.label, | |
740 | b'HG_OTHER_LABEL': otherlabel, |
|
736 | b'HG_OTHER_LABEL': other.label, | |
741 | b'HG_BASE_LABEL': baselabel, |
|
737 | b'HG_BASE_LABEL': base.label, | |
742 | } |
|
738 | } | |
743 | ui = repo.ui |
|
739 | ui = repo.ui | |
744 |
|
740 | |||
@@ -751,9 +747,9 b' def _xmerge(repo, mynode, fcd, fco, fca,' | |||||
751 | b'base': basepath, |
|
747 | b'base': basepath, | |
752 | b'other': otherpath, |
|
748 | b'other': otherpath, | |
753 | b'output': outpath, |
|
749 | b'output': outpath, | |
754 |
b'labellocal': |
|
750 | b'labellocal': local.label, | |
755 | b'labelother': otherlabel, |
|
751 | b'labelother': other.label, | |
756 | b'labelbase': baselabel, |
|
752 | b'labelbase': base.label, | |
757 | } |
|
753 | } | |
758 | args = util.interpolate( |
|
754 | args = util.interpolate( | |
759 | br'\$', |
|
755 | br'\$', | |
@@ -805,7 +801,7 b' def _xmerge(repo, mynode, fcd, fco, fca,' | |||||
805 | return True, r, False |
|
801 | return True, r, False | |
806 |
|
802 | |||
807 |
|
803 | |||
808 |
def _ |
|
804 | def _populate_label_detail(input, template, pad): | |
809 | """Applies the given template to the ctx, prefixed by the label. |
|
805 | """Applies the given template to the ctx, prefixed by the label. | |
810 |
|
806 | |||
811 | Pad is the minimum width of the label prefix, so that multiple markers |
|
807 | Pad is the minimum width of the label prefix, so that multiple markers | |
@@ -826,7 +822,7 b' def _formatlabel(input, template, pad):' | |||||
826 | input.label = stringutil.ellipsis(mark, 80 - 8) |
|
822 | input.label = stringutil.ellipsis(mark, 80 - 8) | |
827 |
|
823 | |||
828 |
|
824 | |||
829 |
def _ |
|
825 | def _populate_label_details(repo, inputs, tool=None): | |
830 | """Formats the given labels using the conflict marker template. |
|
826 | """Formats the given labels using the conflict marker template. | |
831 |
|
827 | |||
832 | Returns a list of formatted labels. |
|
828 | Returns a list of formatted labels. | |
@@ -843,7 +839,8 b' def _formatlabels(repo, inputs, tool=Non' | |||||
843 |
|
839 | |||
844 | pad = max(len(input.label) for input in inputs) |
|
840 | pad = max(len(input.label) for input in inputs) | |
845 |
|
841 | |||
846 | return [_formatlabel(input, tmpl, pad) for input in inputs] |
|
842 | for input in inputs: | |
|
843 | _populate_label_detail(input, tmpl, pad) | |||
847 |
|
844 | |||
848 |
|
845 | |||
849 | def partextras(labels): |
|
846 | def partextras(labels): | |
@@ -1051,11 +1048,10 b' def filemerge(repo, wctx, mynode, orig, ' | |||||
1051 | return func( |
|
1048 | return func( | |
1052 | repo, |
|
1049 | repo, | |
1053 | mynode, |
|
1050 | mynode, | |
1054 |
|
|
1051 | local, | |
1055 |
|
|
1052 | other, | |
1056 |
|
|
1053 | base, | |
1057 | toolconf, |
|
1054 | toolconf, | |
1058 | [local.label, other.label, base.label], |
|
|||
1059 | ) |
|
1055 | ) | |
1060 |
|
1056 | |||
1061 | if orig != fco.path(): |
|
1057 | if orig != fco.path(): | |
@@ -1098,16 +1094,17 b' def filemerge(repo, wctx, mynode, orig, ' | |||||
1098 | # command-templates.mergemarker) |
|
1094 | # command-templates.mergemarker) | |
1099 | labeltool = tool |
|
1095 | labeltool = tool | |
1100 | if internalmarkerstyle != b'basic' or markerstyle != b'basic': |
|
1096 | if internalmarkerstyle != b'basic' or markerstyle != b'basic': | |
1101 | _formatlabels(repo, [local, other, base], tool=labeltool) |
|
1097 | _populate_label_details( | |
|
1098 | repo, [local, other, base], tool=labeltool | |||
|
1099 | ) | |||
1102 |
|
1100 | |||
1103 | r = _premerge( |
|
1101 | r = _premerge( | |
1104 | repo, |
|
1102 | repo, | |
1105 |
|
|
1103 | local, | |
1106 |
|
|
1104 | other, | |
1107 |
|
|
1105 | base, | |
1108 | toolconf, |
|
1106 | toolconf, | |
1109 | backup, |
|
1107 | backup, | |
1110 | labels=[local.label, other.label, base.label], |
|
|||
1111 | ) |
|
1108 | ) | |
1112 | # we're done if premerge was successful (r is 0) |
|
1109 | # we're done if premerge was successful (r is 0) | |
1113 | if not r: |
|
1110 | if not r: | |
@@ -1119,17 +1116,16 b' def filemerge(repo, wctx, mynode, orig, ' | |||||
1119 | base.label = labels[2] |
|
1116 | base.label = labels[2] | |
1120 |
|
1117 | |||
1121 | if markerstyle != b'basic': |
|
1118 | if markerstyle != b'basic': | |
1122 |
_ |
|
1119 | _populate_label_details(repo, [local, other, base], tool=tool) | |
1123 |
|
1120 | |||
1124 | needcheck, r, deleted = func( |
|
1121 | needcheck, r, deleted = func( | |
1125 | repo, |
|
1122 | repo, | |
1126 | mynode, |
|
1123 | mynode, | |
1127 |
|
|
1124 | local, | |
1128 |
|
|
1125 | other, | |
1129 |
|
|
1126 | base, | |
1130 | toolconf, |
|
1127 | toolconf, | |
1131 | backup, |
|
1128 | backup, | |
1132 | labels=[local.label, other.label, base.label], |
|
|||
1133 | ) |
|
1129 | ) | |
1134 |
|
1130 | |||
1135 | if needcheck: |
|
1131 | if needcheck: |
General Comments 0
You need to be logged in to leave comments.
Login now