Don't show the diff in hgeditor if there are no changes in file contents.
authorThomas Arendsen Hein <thomas@intevation.de>
Mon, 22 Aug 2005 19:56:52 +0200
changeset 1009 1bc619b12025312a1d2707f7b3d988609d92874d
parent 1008 85272e96b96a6689608918deaee27b6bf9de19c1
child 1010 f46e809bbe873a3d9230c84273a6958f78615f2e
push id1
push usergszorc@mozilla.com
push dateWed, 18 Mar 2015 16:34:57 +0000
Don't show the diff in hgeditor if there are no changes in file contents.
hgeditor
--- a/hgeditor
+++ b/hgeditor
@@ -46,17 +46,21 @@ HGTMP="${TMPDIR-/tmp}/hgeditor.$RANDOM.$
 echo > "$HGTMP/msg"
 if [ "$SIGN" == "1" ]; then
     MANIFEST=`grep '^HG: manifest hash' "$1" | cut -b 19-`
     echo -e "\nmanifest hash: $MANIFEST" >> "$HGTMP/msg"
 fi
 grep -vE '^(HG: manifest hash .*)?$' "$1" >> "$HGTMP/msg"
 
 CHECKSUM=`md5sum "$HGTMP/msg"`
-$EDITOR "$HGTMP/msg" "$HGTMP/diff" || exit $?
+if [ -s "$HGTMP/diff" ]; then
+    $EDITOR "$HGTMP/msg" "$HGTMP/diff" || exit $?
+else
+    $EDITOR "$HGTMP/msg" || exit $?
+fi
 echo "$CHECKSUM" | md5sum -c >/dev/null 2>&1 && exit 13
 
 if [ "$SIGN" == "1" ]; then
     {
         head -n 1 "$HGTMP/msg"
         echo
         grep -v "^HG:" "$HGTMP/msg" | gpg -t -a -u "${HGUSER}" --clearsign
     } > "$HGTMP/msg.gpg" && mv "$HGTMP/msg.gpg" "$1"