[PATCH 4 of 5] merge: introduce tool.check parameter

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


# HG changeset patch
# User David Champion <dgc at uchicago.edu>
# Date 1273507496 18000
# Node ID 834b8f58de171ea77f274fdd820216d80622882e
# Parent  0b61e87b1e3f0f45b45e2be0a6b32aa4a8aa0c7f
merge: introduce tool.check parameter

tool.check is a list of check options, and can be used in place of
tool.checkchanged and tool.checkconflicts:

Equivalences:
tool.checkchanged = yes
tool.checkconflicts = no
tool.check = changed

tool.checkchanged = no
tool.checkconflicts = yes
tool.check = conflicts

tool.checkchanged = yes
tool.checkconflicts = yes
tool.check = changed, conflicts

Add _toollist() wrapper for ui.configlist() to implement this consistently.

checkchanged and checkconflicts are still supported, but check is
preferred for implementing new check options.

diff -r 0b61e87b1e3f -r 834b8f58de17 doc/hgrc.5.txt
--- a/doc/hgrc.5.txt	Wed Apr 21 12:08:06 2010 -0500
+++ b/doc/hgrc.5.txt	Mon May 10 11:04:56 2010 -0500
@@ -463,13 +463,19 @@
 ``symlink``
   This tool can merge symlinks. Defaults to False, even if tool was
   selected by file pattern match.
+``check``
+  A list of merge success-checking options:
+
+  ``changed``
+    Ask whether merge was successful when the merged file shows no changes.
+  ``conflicts``
+    Check whether there are conflicts even though the tool reported success.
+
+``checkchanged``
+  True is equivalent to ``check = changed``.
+  Default: False
 ``checkconflicts``
-  Check whether there are conflicts even though the tool reported
-  success.
-  Default: False
-``checkchanged``
-  Check whether outputs were written even though the tool reported
-  success.
+  True is equivalent to ``check = conflicts``.
   Default: False
 ``fixeol``
   Attempt to fix up EOL changes caused by the merge tool.
diff -r 0b61e87b1e3f -r 834b8f58de17 mercurial/filemerge.py
--- a/mercurial/filemerge.py	Wed Apr 21 12:08:06 2010 -0500
+++ b/mercurial/filemerge.py	Mon May 10 11:04:56 2010 -0500
@@ -16,6 +16,9 @@
 def _toolbool(ui, tool, part, default=False):
     return ui.configbool("merge-tools", tool + "." + part, default)
 
+def _toollist(ui, tool, part, default=[]):
+    return ui.configlist("merge-tools", tool + "." + part, default)
+
 _internal = ['internal:' + s
              for s in 'fail local other merge prompt dump'.split()]
 
@@ -223,11 +226,13 @@
             lambda x: '"%s"' % util.localpath(replace[x.group()[1:]]), args)
         r = util.system(toolpath + ' ' + args, cwd=repo.root, environ=env)
 
-    if not r and _toolbool(ui, tool, "checkconflicts"):
+    if not r and (_toolbool(ui, tool, "checkconflicts") or
+                  'conflicts' in _toollist(ui, tool, "check")):
         if re.match("^(<<<<<<< .*|=======|>>>>>>> .*)$", fcd.data()):
             r = 1
 
-    if not r and _toolbool(ui, tool, "checkchanged"):
+    if not r 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