mercurial/filemerge.py
changeset 49955 2282d8ac0fa9
parent 49845 e0c0545e2e55
child 50923 c642c03969ff
--- 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,
     _(