#!/bin/sh

if test "${ARCH_ARCHIVE}" = "" -o "${ARCH_REVISION}" = ""; then
    echo "$0: Environment is not set properly - Aborting." 1>&2
    exit 1
fi

report="/tmp/baz-report-${ARCH_REVISION}-${$}"

cat > ${report} <<EOF

This message has been sent automatically to you by GNU Arch (BAZ),
for your information only. A reply is not expected, and will likely
be discarded.

Summary
------------------------------------------------------------------------------
EOF

baz cat-archive-log "${ARCH_ARCHIVE}/${ARCH_REVISION}" >> ${report}

cat >> ${report} <<EOF
------------------------------------------------------------------------------
EOF

mail -s "[baz-autoreport] Commiting ${ARCH_REVISION}" \
     -b "Yann Pouillon <pouillon@pcpm.ucl.ac.be>" \
        "Xavier Gonze <gonze@pcpm.ucl.ac.be>" \
     < ${report}

rm -f ${report}

exit 0
