Commits

Éric Araujo committed 4774633

Import a few changes from my tweaked hgeditor

  • Participants
  • Parent commits f3dcec0

Comments (0)

Files changed (1)

 esac
 
 
+# set envvar that can be useful in the editor
+REPO="$PWD"; export REPO
 HGTMP=""
+
 cleanup_exit() {
     rm -rf "$HGTMP"
 }
 
 HGTMP=$(mktemp -d ${TMPDIR-/tmp}/hgeditor.XXXXXX)
 [ x$HGTMP != x -a -d $HGTMP ] || {
-  echo "Could not create temporary directory! Exiting." 1>&2
+  echo "$0: could not create temporary directory, exiting" 1>&2
   exit 1
 }
 
     done
 )
 
-cat "$1" > "$HGTMP/msg"
+cat "$1" > "$HGTMP/message"
 
 MD5=$(which md5sum 2>/dev/null) || \
     MD5=$(which md5 2>/dev/null)
-[ -x "${MD5}" ] && CHECKSUM=`${MD5} "$HGTMP/msg"`
+[ -x "${MD5}" ] && CHECKSUM=`${MD5} "$HGTMP/message"`
 if [ -s "$HGTMP/diff" ]; then
-    $EDITOR "$HGTMP/msg" "$HGTMP/diff" || exit $?
+    $EDITOR "$HGTMP/message" "$HGTMP/diff" || exit $?
 else
-    $EDITOR "$HGTMP/msg" || exit $?
+    $EDITOR "$HGTMP/message" || exit $?
 fi
+
 [ -x "${MD5}" ] && (echo "$CHECKSUM" | ${MD5} -c >/dev/null 2>&1 && exit 13)
 
-mv "$HGTMP/msg" "$1"
+mv "$HGTMP/message" "$1"
 
 exit $?