[PATCH 5 of 5] merge: tool.check = prompt will force an interactive merge check

David Champion dgc at uchicago.edu
Mon May 10 11:48:22 CDT 2010


# HG changeset patch
# User David Champion <dgc at uchicago.edu>
# Date 1273507496 18000
# Node ID 05bfadea9d45381c097507dfd1ad6339e438de2a
# Parent  834b8f58de171ea77f274fdd820216d80622882e
merge: tool.check = prompt will force an interactive merge check

tool.check = prompt can be used when the exit status of a merge
tool is unreliable but an explicit user signoff on the merge result is
acceptable.

Updates the 'editor' tool to use this flag.

diff -r 834b8f58de17 -r 05bfadea9d45 contrib/mergetools.hgrc
--- a/contrib/mergetools.hgrc	Mon May 10 11:04:56 2010 -0500
+++ b/contrib/mergetools.hgrc	Mon May 10 11:04:56 2010 -0500
@@ -88,7 +88,6 @@
 editor.executable = /bin/sh
 editor.args = -c "${VISUAL:-${EDITOR:-vi}} $local"
 editor.premerge = keep
-editor.checkconflicts = True
-editor.checkchanged = True
+editor.check = conflicts, prompt
 editor.priority = -99
 editor.gui = False
diff -r 834b8f58de17 -r 05bfadea9d45 doc/hgrc.5.txt
--- a/doc/hgrc.5.txt	Mon May 10 11:04:56 2010 -0500
+++ b/doc/hgrc.5.txt	Mon May 10 11:04:56 2010 -0500
@@ -470,6 +470,8 @@
     Ask whether merge was successful when the merged file shows no changes.
   ``conflicts``
     Check whether there are conflicts even though the tool reported success.
+  ``prompt``
+    Always prompt for merge success, regardless of success reported by tool.
 
 ``checkchanged``
   True is equivalent to ``check = changed``.
diff -r 834b8f58de17 -r 05bfadea9d45 mercurial/filemerge.py
--- a/mercurial/filemerge.py	Mon May 10 11:04:56 2010 -0500
+++ b/mercurial/filemerge.py	Mon May 10 11:04:56 2010 -0500
@@ -231,8 +231,15 @@
         if re.match("^(<<<<<<< .*|=======|>>>>>>> .*)$", fcd.data()):
             r = 1
 
-    if not r and (_toolbool(ui, tool, "checkchanged") or
-                  'changed' in _toollist(ui, tool, "check")):
+    checked = False
+    if 'prompt' in _toollist(ui, tool, "check"):
+        checked = True
+        if ui.promptchoice(_("was merge of '%s' successful (yn)?") % fd,
+                           (_("&Yes"), _("&No")), 1):
+            r = 1
+
+    if not r and not checked and (_toolbool(ui, tool, "checkchanged") or
+                                  'changed' in _toollist(ui, tool, "check")):
         if filecmp.cmp(repo.wjoin(fd), back):
             if ui.promptchoice(_(" output file %s appears unchanged\n"
                                  "was merge successful (yn)?") % fd,


More information about the Mercurial-devel mailing list