filemerge: add a 'leave unresolved' option to regular prompts
authorSiddharth Agarwal <sid0@fb.com>
Mon, 30 Nov 2015 11:17:18 -0800
changeset 27162 4ab69be0ea15
parent 27161 296d55def9c4
child 27163 27b89a0957ec
filemerge: add a 'leave unresolved' option to regular prompts 'Regular' here means anything that isn't a change/delete prompt. We'll add this option to change/delete prompts in a subsequent patch.
mercurial/filemerge.py
tests/test-merge-changedelete.t
tests/test-merge-tools.t
tests/test-merge-types.t
--- a/mercurial/filemerge.py	Wed Nov 25 14:25:26 2015 -0800
+++ b/mercurial/filemerge.py	Mon Nov 30 11:17:18 2015 -0800
@@ -249,15 +249,18 @@
                   "$$ &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]
+            index = ui.promptchoice(
+                _("no tool found to merge %s\n"
+                  "keep (l)ocal, take (o)ther, or leave (u)nresolved?"
+                  "$$ &Local $$ &Other $$ &Unresolved") % fd, 0)
+            choice = ['local', 'other', 'unresolved'][index]
 
         if choice == 'other':
             return _iother(repo, mynode, orig, fcd, fco, fca, toolconf)
-        else:
+        elif choice == 'local':
             return _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf)
+        elif choice == 'unresolved':
+            return _ifail(repo, mynode, orig, fcd, fco, fca, toolconf)
     except error.ResponseExpected:
         ui.write("\n")
         return _ifail(repo, mynode, orig, fcd, fco, fca, toolconf)
--- a/tests/test-merge-changedelete.t	Wed Nov 25 14:25:26 2015 -0800
+++ b/tests/test-merge-changedelete.t	Mon Nov 30 11:17:18 2015 -0800
@@ -422,7 +422,7 @@
   remote changed file2 which local deleted
   use (c)hanged version or leave (d)eleted? 
   no tool found to merge file3
-  keep (l)ocal or take (o)ther? 
+  keep (l)ocal, take (o)ther, or leave (u)nresolved? 
   0 files updated, 0 files merged, 0 files removed, 3 files unresolved
   use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
   [1]
@@ -474,7 +474,7 @@
   remote changed file2 which local deleted
   use (c)hanged version or leave (d)eleted? c
   no tool found to merge file3
-  keep (l)ocal or take (o)ther? l
+  keep (l)ocal, take (o)ther, or leave (u)nresolved? l
   0 files updated, 3 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
   $ status
@@ -607,7 +607,7 @@
   remote changed file2 which local deleted
   use (c)hanged version or leave (d)eleted? 
   no tool found to merge file3
-  keep (l)ocal or take (o)ther? 
+  keep (l)ocal, take (o)ther, or leave (u)nresolved? 
   --- diff of status ---
   (status identical)
   
@@ -636,7 +636,7 @@
   remote changed file2 which local deleted
   use (c)hanged version or leave (d)eleted? 
   no tool found to merge file3
-  keep (l)ocal or take (o)ther? 
+  keep (l)ocal, take (o)ther, or leave (u)nresolved? 
   --- diff of status ---
   (status identical)
   
@@ -655,7 +655,7 @@
   remote changed file2 which local deleted
   use (c)hanged version or leave (d)eleted? 
   no tool found to merge file3
-  keep (l)ocal or take (o)ther? 
+  keep (l)ocal, take (o)ther, or leave (u)nresolved? 
   --- diff of status ---
   (status identical)
   
--- a/tests/test-merge-tools.t	Wed Nov 25 14:25:26 2015 -0800
+++ b/tests/test-merge-tools.t	Mon Nov 30 11:17:18 2015 -0800
@@ -532,7 +532,7 @@
   # hg update -C 1
   $ hg merge -r 2 --config ui.merge=internal:prompt
   no tool found to merge f
-  keep (l)ocal or take (o)ther? l
+  keep (l)ocal, take (o)ther, or leave (u)nresolved? l
   0 files updated, 1 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
   $ aftermerge
@@ -544,6 +544,31 @@
   # hg resolve --list
   R f
 
+ui.merge specifies :prompt, with 'leave unresolved' chosen
+
+  $ beforemerge
+  [merge-tools]
+  false.whatever=
+  true.priority=1
+  true.executable=cat
+  # hg update -C 1
+  $ hg merge -r 2 --config ui.merge=:prompt --config ui.interactive=True << EOF
+  > u
+  > EOF
+  no tool found to merge f
+  keep (l)ocal, take (o)ther, or leave (u)nresolved? u
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
+  [1]
+  $ aftermerge
+  # cat f
+  revision 1
+  space
+  # hg stat
+  M f
+  # hg resolve --list
+  U f
+
 prompt with EOF
 
   $ beforemerge
@@ -554,7 +579,7 @@
   # hg update -C 1
   $ hg merge -r 2 --config ui.merge=internal:prompt --config ui.interactive=true
   no tool found to merge f
-  keep (l)ocal or take (o)ther? 
+  keep (l)ocal, take (o)ther, or leave (u)nresolved? 
   0 files updated, 0 files merged, 0 files removed, 1 files unresolved
   use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
   [1]
@@ -568,7 +593,7 @@
   U f
   $ hg resolve --all --config ui.merge=internal:prompt --config ui.interactive=true
   no tool found to merge f
-  keep (l)ocal or take (o)ther? 
+  keep (l)ocal, take (o)ther, or leave (u)nresolved? 
   [1]
   $ aftermerge
   # cat f
@@ -582,7 +607,7 @@
   $ rm f
   $ hg resolve --all --config ui.merge=internal:prompt --config ui.interactive=true
   no tool found to merge f
-  keep (l)ocal or take (o)ther? 
+  keep (l)ocal, take (o)ther, or leave (u)nresolved? 
   [1]
   $ aftermerge
   # cat f
@@ -594,7 +619,7 @@
   U f
   $ hg resolve --all --config ui.merge=internal:prompt
   no tool found to merge f
-  keep (l)ocal or take (o)ther? l
+  keep (l)ocal, take (o)ther, or leave (u)nresolved? l
   (no more unresolved files)
   $ aftermerge
   # cat f
--- a/tests/test-merge-types.t	Wed Nov 25 14:25:26 2015 -0800
+++ b/tests/test-merge-types.t	Mon Nov 30 11:17:18 2015 -0800
@@ -172,7 +172,7 @@
   (couldn't find merge tool hgmerge|tool hgmerge can't handle symlinks) (re)
   picked tool ':prompt' for a (binary False symlink True changedelete False)
   no tool found to merge a
-  keep (l)ocal or take (o)ther? l
+  keep (l)ocal, take (o)ther, or leave (u)nresolved? l
   0 files updated, 1 files merged, 0 files removed, 0 files unresolved
   $ hg diff --git
   diff --git a/a b/a