changeset 1774:ac7b91bcbd8d

hgmerge: add meld support
author Radoslaw Szkodzinski <astralstorm@gorzow.mm.pl>
date Tue, 21 Feb 2006 15:48:22 -0600
parents aae93c3bffb4
children 0762feff3043
files hgmerge
diffstat 1 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgmerge	Tue Feb 21 15:48:19 2006 -0600
+++ b/hgmerge	Tue Feb 21 15:48:22 2006 -0600
@@ -34,10 +34,12 @@
 FILEMERGE="/Developer/Applications/Utilities/FileMerge.app/Contents/MacOS/FileMerge"
 KDIFF3="kdiff3"
 TKDIFF="tkdiff"
+MELD="meld"
 
 type "$FILEMERGE" >/dev/null 2>&1 || FILEMERGE=
 type "$KDIFF3"    >/dev/null 2>&1 || KDIFF3=
 type "$TKDIFF"    >/dev/null 2>&1 || TKDIFF=
+type "$MELD"      >/dev/null 2>&1 || MELD=
 
 # random part of names
 RAND="$RANDOM$RANDOM"
@@ -124,6 +126,17 @@
         $TKDIFF "$LOCAL" "$OTHER" -a "$BASE" -o "$LOCAL" || failure
         success
     fi
+
+    if [ -n "$MELD" ]; then
+        cp "$BACKUP" "$CHGTEST"
+        # protect our feet - meld allows us to save to the left file
+        cp "$BACKUP" "$LOCAL.tmp.$RAND"
+        # Meld doesn't have automatic merging, so to reduce intervention
+        # use the file with conflicts
+        $MELD "$LOCAL.tmp.$RAND" "$LOCAL" "$OTHER" || failure
+        # Also it doesn't return good error code
+        test "$LOCAL" -nt "$CHGTEST" && success || ask_if_merged
+    fi
 fi
 
 # Attempt to do a merge with $EDITOR
@@ -158,6 +171,6 @@
 echo
 echo "hgmerge: unable to find any merge utility!"
 echo "supported programs:"
-echo "merge, FileMerge, tkdiff, kdiff3, diff+patch"
+echo "merge, FileMerge, tkdiff, kdiff3, meld, diff+patch"
 echo
 failure