#! /bin/sh

# Small wrapper around bzr_hookless_email.py, to be run for projects in
# alioth.debian.org.
#
# Just give the name of the Alioth project as the first argument; the
# commit address will be guessed ($PROJECT-commits@lists.alioth.debian.org),
# and extra arguments will be passed verbatim to bzr_hookless_email.py.

set -e

if [ $# -lt 1 ]; then
    echo >&2 "E: need at least one argument, the project name."
    exit 1
fi

BZR_HOOKLESS_EMAIL='/var/lib/gforge/chroot/home/users/adeodato/bzr-hookless-email/bzr_hookless_email.py'
PROJECT="$1"
shift

cd "/srv/bzr.debian.org/bzr/$PROJECT"
exec $BZR_HOOKLESS_EMAIL -e "$PROJECT-commits@lists.alioth.debian.org" -r . "$@"
