hgmerge: use diff3 if available
authormpm@selenic.com
Fri, 03 Jun 2005 18:42:53 -0800
changeset 242 a2edb4481f19
parent 241 afe895fcc0d0
child 243 9a9ea2d1d3c4
hgmerge: use diff3 if available -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 hgmerge: use diff3 if available diff3 may be more readily available than merge manifest hash: 67a314ac42aa78410d64a6c3d36c2d575a588533 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCoRUtywK+sNU5EO8RAmFPAJ0aN8VNvN9zpE/zov6wT3M98vGfDwCfXEOk xZlQHYIGrCLOFQiCQxIfr7I= =Asv9 -----END PGP SIGNATURE-----
hgmerge
--- a/hgmerge	Fri Jun 03 18:29:46 2005 -0800
+++ b/hgmerge	Fri Jun 03 18:42:53 2005 -0800
@@ -21,6 +21,12 @@
 	exit 0
     fi
     cp $LOCAL.orig $LOCAL
+elif which diff3 > /dev/null ; then
+    if diff3 -m $LOCAL.orig $BASE $OTHER > $LOCAL ; then
+	# success
+	exit 0
+    fi
+    cp $LOCAL.orig $LOCAL
 fi
 
 # try using kdiff3, which is fairly nice
@@ -45,6 +51,13 @@
 if which merge > /dev/null ; then
     echo "conflicts detected in $LOCAL"
     merge $LOCAL $BASE $OTHER 2>/dev/null || $EDITOR $LOCAL
+    exit 0
+fi
+
+if which diff3 > /dev/null ; then
+    echo "conflicts detected in $LOCAL"
+    diff3 -m $LOCAL.orig $BASE $OTHER > $LOCAL || $EDITOR $LOCAL
+    exit 0
 fi
 
 # attempt to manually merge with diff and patch
@@ -64,5 +77,3 @@
 
 echo "hgmerge: unable to find merge, tkdiff, kdiff3, or diff+patch!"
 exit 1
-
-