Commits

Anonymous committed 1d9ad98 Merge

Merged

Comments (0)

Files changed (1)

+#! /bin/sh
+# hgmerge.sh - invoke diff3 to merge files, save conflicts in mine.hgmerge
+#
+# author: Noel Burton-Krahn
+# created: Feb 28, 2007
+
+# exit on error or undefined variables
+set -eu
+
+# command-line args
+mine="$1"
+orig="$2"
+other="$3"
+
+# where to save merged file
+merged="$mine".hgmerge
+cp $mine "$mine.mine~"
+cp $orig "$mine.orig~"
+cp $other "$mine.other~"
+
+rm -f "$merged"
+if diff3 -L mine -L original -L other -E -m "$mine" "$orig" "$other" > "$merged"
+then
+    mv "$merged" "$mine"
+    rm -f "$mine.mine~"
+    rm -f "$mine.orig~"
+    rm -f "$mine.other~"
+    echo Merged "$mine"
+else
+    mv "$merged" "$mine"
+    echo "! $mine"
+    exit 1
+fi