claws-mail/commitHelper
2004-07-28 07:56:28 +00:00

87 lines
2.2 KiB
Bash

#!/bin/sh
head -16 configure.ac | grep VERSION= > /tmp/commitTool.tmp
source /tmp/commitTool.tmp
if [ -z "$EXTRA_GTK2_VERSION" ]; then
EXTRA_VERSION=`echo $EXTRA_VERSION | awk -F'.' '{for (i=1;i<NF;i++){printf $i"."};printf $NF+1}'`
nextsversion="${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}cvs${EXTRA_VERSION}"
else
EXTRA_GTK2_VERSION=`echo $EXTRA_GTK2_VERSION | awk -F'.' '{for (i=1;i<NF;i++){printf $i"."};printf $NF+1}'`
nextsversion="${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}cvs${EXTRA_VERSION}${EXTRA_GTK2_VERSION}"
fi
rm /tmp/commitTool.tmp
IFS='
'
filelist=`cvs status $@ 2>/dev/null |grep ^File`
for file in $filelist; do
merge=`echo $file | grep Merge`
modif=`echo $file | grep Locally`
if [ "$merge" != "" ]; then
echo $merge
echo You have to update first
exit
fi;
if [ "$modif" != "" ]; then
echo $modif
fi;
done;
patchset="("
log=""
files=`cvs diff -u $@ 2>/dev/null |grep ^Index`
echo "--8<----------"
name=`whoami`
#change if your login isn't your name
if [ "$name" == "claws" ]; then
name="paul";
fi;
if [ "$name" == "reboot" ]; then
name="christoph";
fi;
log="`date +%Y-%m-%d` [$name]\t$nextsversion\n\n"
for line in $files; do
file=`echo $line | cut -d' ' -f2`
dir=`dirname $file`
filename=`basename $file`
cvsfile="$dir/CVS/Entries"
version=`grep "\/$filename\/" $cvsfile | cut -d'/' -f3`
nextversion=`echo $version | awk -F'.' '{for (i=1;i<NF;i++){printf $i"."};printf $NF+1}'`
log="$log\t* $file\n"
patchset="$patchset cvs diff -u -r $version -r $nextversion $file;\
"
done;
patchset="$patchset ) > $nextsversion.patchset"
log="$log\n"
echo -e -n $log
echo "--8<----------"
if [ -f ChangeLog-gtk2.claws ]; then
chlog="ChangeLog-gtk2.claws"
elif [ -f ChangeLog.claws ]; then
chlog="ChangeLog.claws"
else
chlog="ChangeLog"
fi
echo -n "Is it ok (write to $chlog) [y/N]?"
read ans
if [ "$ans" == "y" ]; then
mv $chlog $chlog.old
echo -e -n $log > $chlog
cat $chlog.old >> $chlog
rm $chlog.old
echo "$patchset" >> PATCHSETS
echo "editing $chlog configure.ac..."
if [ "$EDITOR" == "" ]; then
EDITOR=vi
fi;
$EDITOR $chlog configure.ac
if [ "$@" != "" ]; then
echo running cvs commit $@ PATCHSETS $chlog configure.ac
cvs commit $@ PATCHSETS $chlog configure.ac
else
echo running cvs commit
cvs commit
fi;
fi