Mercurial > public > mercurial-scm > hg
comparison mercurial/filemerge.py @ 48509:5151b0f6519e
simplemerge: make `localorother` a "mode" instead of a separate thing
`simplemerge()` takes a `mode` argument, which can be "union", "merge"
or "mergediff", and a `localorother` argument, which can be `None`,
"local", or "other". The two options are not at all orthogonal -- most
combinations don't make sense. Also, at least "union", "local", and
"other" are very closely related. Therefore, it makes sense to combine
them into one.
It probably makes sense to split the `mode` argument into `resolve`
and `marker_style`, where the former can be `None`, "union", "local",
or "other", and the latter can be "merge", "merge3", "mergediff", or
"minimize". This is a good step in that direction whether or not we
end up doing that.
Differential Revision: https://phab.mercurial-scm.org/D11887
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 07 Dec 2021 17:48:50 -0800 |
parents | 608a35db186c |
children | c91418480cb0 |
comparison
equal
deleted
inserted
replaced
48508:fa159bb463e6 | 48509:5151b0f6519e |
---|---|
577 return _merge( | 577 return _merge( |
578 repo, mynode, fcd, fco, fca, toolconf, backup, labels, b'mergediff' | 578 repo, mynode, fcd, fco, fca, toolconf, backup, labels, b'mergediff' |
579 ) | 579 ) |
580 | 580 |
581 | 581 |
582 def _imergeauto( | |
583 repo, | |
584 mynode, | |
585 fcd, | |
586 fco, | |
587 fca, | |
588 toolconf, | |
589 backup, | |
590 labels=None, | |
591 localorother=None, | |
592 ): | |
593 """ | |
594 Generic driver for _imergelocal and _imergeother | |
595 """ | |
596 assert localorother is not None | |
597 r = simplemerge.simplemerge( | |
598 repo.ui, fcd, fca, fco, label=labels, localorother=localorother | |
599 ) | |
600 return True, r | |
601 | |
602 | |
603 @internaltool(b'merge-local', mergeonly, precheck=_mergecheck) | 582 @internaltool(b'merge-local', mergeonly, precheck=_mergecheck) |
604 def _imergelocal(*args, **kwargs): | 583 def _imergelocal(repo, mynode, fcd, fco, fca, toolconf, backup, labels=None): |
605 """ | 584 """ |
606 Like :merge, but resolve all conflicts non-interactively in favor | 585 Like :merge, but resolve all conflicts non-interactively in favor |
607 of the local `p1()` changes.""" | 586 of the local `p1()` changes.""" |
608 success, status = _imergeauto(localorother=b'local', *args, **kwargs) | 587 return _merge( |
609 return success, status, False | 588 repo, mynode, fcd, fco, fca, toolconf, backup, labels, b'local' |
589 ) | |
610 | 590 |
611 | 591 |
612 @internaltool(b'merge-other', mergeonly, precheck=_mergecheck) | 592 @internaltool(b'merge-other', mergeonly, precheck=_mergecheck) |
613 def _imergeother(*args, **kwargs): | 593 def _imergeother(repo, mynode, fcd, fco, fca, toolconf, backup, labels=None): |
614 """ | 594 """ |
615 Like :merge, but resolve all conflicts non-interactively in favor | 595 Like :merge, but resolve all conflicts non-interactively in favor |
616 of the other `p2()` changes.""" | 596 of the other `p2()` changes.""" |
617 success, status = _imergeauto(localorother=b'other', *args, **kwargs) | 597 return _merge( |
618 return success, status, False | 598 repo, mynode, fcd, fco, fca, toolconf, backup, labels, b'other' |
599 ) | |
619 | 600 |
620 | 601 |
621 @internaltool( | 602 @internaltool( |
622 b'tagmerge', | 603 b'tagmerge', |
623 mergeonly, | 604 mergeonly, |