# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 2015-11-18 23:41:50
# Node ID a8908c139f2fff634e37fabb15536d63237fb0d1
# Parent  63d6bc874dea3d98ebbd4835654b3cb72119caef

filemerge: add support for change/delete conflicts to the ':other' merge tool

This, along with the previous patch to the :local merge tool, covers the full
matrix of change/delete conflicts.

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -242,8 +242,14 @@ def _ilocal(repo, mynode, orig, fcd, fco
 @internaltool('other', nomerge)
 def _iother(repo, mynode, orig, fcd, fco, fca, toolconf):
     """Uses the other version of files as the merged version."""
-    repo.wwrite(fcd.path(), fco.data(), fco.flags())
-    return 0, False
+    if fco.isabsent():
+        # local changed, remote deleted -- 'deleted' picked
+        repo.wvfs.unlinkpath(fcd.path())
+        deleted = True
+    else:
+        repo.wwrite(fcd.path(), fco.data(), fco.flags())
+        deleted = False
+    return 0, deleted
 
 @internaltool('fail', nomerge)
 def _ifail(repo, mynode, orig, fcd, fco, fca, toolconf):