3 # Copyright (C) 2004 Chris Larson <kergoth@handhelds.org>
5 # Sanity checks taken from the scripts on commits.bkbits.net
6 # Copyright (C) 2003 Leonard Norrgard <leonard.norrgard@refactor.fi>
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place - Suite 330,
21 # Boston, MA 02111-1307, USA.
24 if [ X$BK_STATUS = XDRYRUN -o X$BK_STATUS = XNOTHING ]; then
28 # In order to make sure only pushes to public BitKeeper repositories
29 # are broadcasted to #commits, we check that a) the parent repository
30 # is on bkbits.net and b) we are the client.
32 # Is parent a public BitKeeper repository at bkbits.net?
33 if !(echo $BKD_HOST|grep -q bitkeeper.com); then
37 if [ $BK_SIDE != client ]; then
42 # Check sanity - do we need to send anything?
43 check_sanity || exit 0
45 if (grep -q 'ChangeSet' $BK_CSETLIST); then
46 # new, correct csets-out format
47 nums=`bk changes -d:REV: - < $BK_CSETLIST`
50 # Convert numbers from the cset list into something useful
52 for s in `cat $BK_CSETLIST`; do
53 # translate cset serial to cset #
54 n=`bk prs -h -d"\\$if(:DS: -eq $s){:REV:}" ChangeSet`
55 # dont send notifications about empty ChangeSets
56 if test -z `bk prs -h -r"$n" -d'$if(:LI: -eq 0){$if(:LD: -eq 0){:REV:}}' ChangeSet`; then
62 # Send notifications to CIA
63 if test -n "$nums"; then
64 echo "Sending notification to CIA irc bot (cia.navi.cx)."
67 $BK_ROOT/BitKeeper/triggers/ciabot_bk.sh $n