Patchwork [2,of,7,mergedriver] filemerge: add support for change/delete conflicts to the ':other' merge tool

login
register
mail settings
Submitter Siddharth Agarwal
Date Nov. 19, 2015, 9:33 p.m.
Message ID <fcf43805474acb080283.1447968834@dev666.prn1.facebook.com>
Download mbox | patch
Permalink /patch/11533/
State Accepted
Delegated to: Martin von Zweigbergk
Headers show

Comments

Siddharth Agarwal - Nov. 19, 2015, 9:33 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1447890110 28800
#      Wed Nov 18 15:41:50 2015 -0800
# Node ID fcf43805474acb08028332307e63559a3d5a0afb
# Parent  1b30c58e408645fd4a25e0d66d986523208d5302
# Available At http://42.netv6.net/sid0-wip/hg/
#              hg pull http://42.netv6.net/sid0-wip/hg/ -r fcf43805474a
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.

Patch

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):