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

login
register
mail settings
Submitter Siddharth Agarwal
Date Nov. 19, 2015, 9:33 p.m.
Message ID <696cd54b8958729b6b17.1447968835@dev666.prn1.facebook.com>
Download mbox | patch
Permalink /patch/11535/
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 1447487546 28800
#      Fri Nov 13 23:52:26 2015 -0800
# Node ID 696cd54b8958729b6b1763b19a159c3c97b7b72b
# Parent  fcf43805474acb08028332307e63559a3d5a0afb
# Available At http://42.netv6.net/sid0-wip/hg/
#              hg pull http://42.netv6.net/sid0-wip/hg/ -r 696cd54b8958
filemerge: add support for change/delete conflicts to the ':prompt' tool

We haven't added the 'leave unresolved' option yet -- that will come in a
future patch.

Patch

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -221,10 +221,23 @@  def _iprompt(repo, mynode, orig, fcd, fc
     fd = fcd.path()
 
     try:
-        index = ui.promptchoice(_("no tool found to merge %s\n"
-                                  "keep (l)ocal or take (o)ther?"
-                                  "$$ &Local $$ &Other") % fd, 0)
-        choice = ['local', 'other'][index]
+        if fco.isabsent():
+            index = ui.promptchoice(
+                _("local changed %s which remote deleted\n"
+                  "use (c)hanged version or (d)elete?"
+                  "$$ &Changed $$ &Delete") % fd, 0)
+            choice = ['local', 'other'][index]
+        elif fcd.isabsent():
+            index = ui.promptchoice(
+                _("remote changed %s which local deleted\n"
+                  "use (c)hanged version or leave (d)eleted?"
+                  "$$ &Changed $$ &Deleted") % fd, 0)
+            choice = ['other', 'local'][index]
+        else:
+            index = ui.promptchoice(_("no tool found to merge %s\n"
+                                      "keep (l)ocal or take (o)ther?"
+                                      "$$ &Local $$ &Other") % fd, 0)
+            choice = ['local', 'other'][index]
 
         if choice == 'other':
             return _iother(repo, mynode, orig, fcd, fco, fca, toolconf)