[PATCH 1 of 2] filemerge: add 'checkchanged' merge tool property

Steve Borho steve at borho.org
Wed Feb 6 21:33:33 CST 2008


# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1202351526 21600
# Node ID 160c9ee81ad826cc0af8af7d9aeaa0f91e4d12d8
# Parent  b7f44f01a632ab4a59f276de21dc3c5d8f1b8560
filemerge: add 'checkchanged' merge tool property

diff --git a/contrib/mergetools.hgrc b/contrib/mergetools.hgrc
--- a/contrib/mergetools.hgrc
+++ b/contrib/mergetools.hgrc
@@ -28,6 +28,7 @@
 xxdiff.priority=-8
 
 diffmerge.args=--nosplash --merge --title1=base --title2=local --title3=other $base $local $other
+diffmerge.checkchanged=True
 diffmerge.gui=True
 
 p4merge.args=$base $local $other $output
diff --git a/doc/hgrc.5.txt b/doc/hgrc.5.txt
--- a/doc/hgrc.5.txt
+++ b/doc/hgrc.5.txt
@@ -287,6 +287,10 @@
     selected by file pattern match.
   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.
     Default: False
   fixeol;;
diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -7,7 +7,7 @@
 
 from node import *
 from i18n import _
-import util, os, tempfile, context, simplemerge, re
+import util, os, tempfile, context, simplemerge, re, filecmp
 
 def _toolstr(ui, tool, part, default=""):
     return ui.config("merge-tools", tool + "." + part, default)
@@ -193,6 +193,13 @@
         if re.match("^(<<<<<<< .*|=======|>>>>>>> .*)$", fcm.data()):
             r = 1
 
+    if not r and _toolbool(ui, tool, "checkchanged"):
+        if filecmp.cmp(repo.wjoin(fd), back):
+            if ui.prompt(_(" output file %s appears unchanged\n"
+                "was merge successful (yn)?") % fd,
+                _("[yn]"), _("n")) != _("y"):
+                r = 1
+
     if _toolbool(ui, tool, "fixeol"):
         _matcheol(repo.wjoin(fd), back)
 


More information about the Mercurial-devel mailing list