Patchwork [4,of,4,mergedriver] filemerge: default regular prompts to 'leave unresolved' (BC)

login
register
mail settings
Submitter Siddharth Agarwal
Date Dec. 1, 2015, 5:57 p.m.
Message ID <2c40d5addf46f6b712d3.1448992665@dev666.prn1.facebook.com>
Download mbox | patch
Permalink /patch/11731/
State Accepted
Headers show

Comments

Siddharth Agarwal - Dec. 1, 2015, 5:57 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1448992118 28800
#      Tue Dec 01 09:48:38 2015 -0800
# Node ID 2c40d5addf46f6b712d38540b2dd51c2f22d9a96
# Parent  742869a0c53d2f50f835aad600b8609dcdd5229c
# Available At http://42.netv6.net/sid0-wip/hg/
#              hg pull http://42.netv6.net/sid0-wip/hg/ -r 2c40d5addf46
filemerge: default regular prompts to 'leave unresolved' (BC)

It makes far more sense to leave these conflicts unresolved and kick back to
the user than to just assume that the local version be chosen. There are almost
certainly buggy scripts and applications using Mercurial in the wild that do
merges or rebases non-interactively, and then assume that if the operation
succeeded there's nothing the user needs to pay attention to.
Martin von Zweigbergk - Dec. 1, 2015, 10:34 p.m.
On Tue, Dec 1, 2015 at 1:24 PM Siddharth Agarwal <sid0@fb.com> wrote:

> # HG changeset patch
> # User Siddharth Agarwal <sid0@fb.com>
> # Date 1448992118 28800
> #      Tue Dec 01 09:48:38 2015 -0800
> # Node ID 2c40d5addf46f6b712d38540b2dd51c2f22d9a96
> # Parent  742869a0c53d2f50f835aad600b8609dcdd5229c
> # Available At http://42.netv6.net/sid0-wip/hg/
> #              hg pull http://42.netv6.net/sid0-wip/hg/ -r 2c40d5addf46
> filemerge: default regular prompts to 'leave unresolved' (BC)
>
> It makes far more sense to leave these conflicts unresolved and kick back
> to
> the user than to just assume that the local version be chosen. There are
> almost
> certainly buggy scripts and applications using Mercurial in the wild that
> do
> merges or rebases non-interactively, and then assume that if the operation
> succeeded there's nothing the user needs to pay attention to.
>

Great.

Nice series! Pushed to the clowncopter.

Patch

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -253,7 +253,7 @@  def _iprompt(repo, mynode, orig, fcd, fc
             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)
+                  "$$ &Local $$ &Other $$ &Unresolved") % fd, 2)
             choice = ['local', 'other', 'unresolved'][index]
 
         if choice == 'other':
diff --git a/tests/test-merge-changedelete.t b/tests/test-merge-changedelete.t
--- a/tests/test-merge-changedelete.t
+++ b/tests/test-merge-changedelete.t
@@ -474,9 +474,10 @@  Force prompts
   remote changed file2 which local deleted
   use (c)hanged version, leave (d)eleted, or leave (u)nresolved? c
   no tool found to merge file3
-  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)
+  keep (l)ocal, take (o)ther, or leave (u)nresolved? u
+  0 files updated, 2 files merged, 0 files removed, 1 files unresolved
+  use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
+  [1]
   $ status
   --- status ---
   M file2
@@ -485,7 +486,7 @@  Force prompts
   --- resolve --list ---
   R file1
   R file2
-  R file3
+  U file3
   --- debugmergestate ---
   * version 2 records
   local: 13910f48cf7bdb2a0ba6e24b4900e4fdd5739dd4
@@ -498,7 +499,7 @@  Force prompts
     local path: file2 (flags "")
     ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
     other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
-  file: file3 (record type "F", state "r", hash d5b0a58bc47161b1b8a831084b366f757c4f0b11)
+  file: file3 (record type "F", state "u", hash d5b0a58bc47161b1b8a831084b366f757c4f0b11)
     local path: file3 (flags "")
     ancestor path: file3 (node 2661d26c649684b482d10f91960cc3db683c38b4)
     other path: file3 (node a2644c43e210356772c7772a8674544a62e06beb)
diff --git a/tests/test-merge-tools.t b/tests/test-merge-tools.t
--- a/tests/test-merge-tools.t
+++ b/tests/test-merge-tools.t
@@ -532,9 +532,10 @@  ui.merge specifies internal:prompt:
   # hg update -C 1
   $ hg merge -r 2 --config ui.merge=internal:prompt
   no tool found to merge f
-  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)
+  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
@@ -542,7 +543,7 @@  ui.merge specifies internal:prompt:
   # hg stat
   M f
   # hg resolve --list
-  R f
+  U f
 
 ui.merge specifies :prompt, with 'leave unresolved' chosen
 
@@ -619,8 +620,8 @@  prompt with EOF
   U f
   $ hg resolve --all --config ui.merge=internal:prompt
   no tool found to merge f
-  keep (l)ocal, take (o)ther, or leave (u)nresolved? l
-  (no more unresolved files)
+  keep (l)ocal, take (o)ther, or leave (u)nresolved? u
+  [1]
   $ aftermerge
   # cat f
   revision 1
@@ -629,7 +630,7 @@  prompt with EOF
   M f
   ? f.orig
   # hg resolve --list
-  R f
+  U f
 
 ui.merge specifies internal:dump: