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

Siddharth Agarwal sid0 at fb.com
Thu Nov 19 21:33:55 UTC 2015


# HG changeset patch
# User Siddharth Agarwal <sid0 at 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.

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)



More information about the Mercurial-devel mailing list