Mercurial > public > mercurial-scm > hg
diff mercurial/filemerge.py @ 49956:2282d8ac0fa9
filemerge: add union-other-first as internal merge tool
See inline documentation for details.
author | C?dric Krier <ced@b2ck.com> |
---|---|
date | Thu, 26 Jan 2023 00:23:07 +0100 |
parents | e0c0545e2e55 |
children | c642c03969ff |
line wrap: on
line diff
--- a/mercurial/filemerge.py Fri Jan 13 00:07:07 2023 +0100 +++ b/mercurial/filemerge.py Thu Jan 26 00:23:07 2023 +0100 @@ -478,8 +478,9 @@ """ Uses the internal non-interactive simple merge algorithm for merging files. It will fail if there are any conflicts and leave markers in - the partially merged file. Markers will have two sections, one for each side - of merge, unless mode equals 'union' which suppresses the markers.""" + the partially merged file. Markers will have two sections, one for each + side of merge, unless mode equals 'union' or 'union-other-first' which + suppresses the markers.""" ui = repo.ui try: @@ -510,12 +511,28 @@ def _iunion(repo, mynode, local, other, base, toolconf, backup): """ Uses the internal non-interactive simple merge algorithm for merging - files. It will use both left and right sides for conflict regions. + files. It will use both local and other sides for conflict regions by + adding local on top of other. No markers are inserted.""" return _merge(repo, local, other, base, b'union') @internaltool( + b'union-other-first', + fullmerge, + _( + b"warning: conflicts while merging %s! " + b"(edit, then use 'hg resolve --mark')\n" + ), + precheck=_mergecheck, +) +def _iunion_other_first(repo, mynode, local, other, base, toolconf, backup): + """ + Like :union, but add other on top of local.""" + return _merge(repo, local, other, base, b'union-other-first') + + +@internaltool( b'merge', fullmerge, _(