use the right name
[claws.git] / commitHelper
1 #!/bin/sh
2 head -15 configure.ac | grep VERSION > /tmp/commitTool.tmp
3 source /tmp/commitTool.tmp
4 EXTRA_VERSION=`echo $EXTRA_VERSION | awk -F'.' '{for (i=1;i<NF;i++){printf $i"."};printf $NF+1}'`
5 nextsversion="${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}cvs${EXTRA_VERSION}"
6 rm /tmp/commitTool.tmp
7
8 IFS='
9 '
10 filelist=`cvs status $@ 2>/dev/null |grep ^File`
11
12 for file in $filelist; do
13         merge=`echo $file | grep Merge`
14         modif=`echo $file | grep Locally`
15
16         if [ "$merge" != "" ]; then
17                 echo $merge
18                 echo You have to update first
19                 exit
20         fi;
21         if [ "$modif" != "" ]; then
22                 echo $modif
23         fi;
24 done;
25 patchset="("
26 log=""
27 files=`cvs diff -u $@ 2>/dev/null |grep ^Index`
28 echo "--8<----------"
29 log="`date +%Y-%m-%d` [`whoami`]\t$nextsversion\n\n"
30 for line in $files; do
31         file=`echo $line | cut -d' ' -f2`
32         dir=`dirname $file`
33         filename=`basename $file`
34         cvsfile="$dir/CVS/Entries"
35         version=`grep $filename $cvsfile | cut -d'/' -f3`
36         nextversion=`echo $version | awk -F'.' '{for (i=1;i<NF;i++){printf $i"."};printf $NF+1}'`
37         
38         log="$log\t* $file [$nextversion]\n"
39         patchset="$patchset cvs diff -u -r $version -r $nextversion $file;\
40 "
41 done;
42 patchset="$patchset ) > $nextsversion.patchset"
43 log="$log\n"
44 echo -e -n $log
45 echo "--8<----------"
46 if [ -f ChangeLog-gtk2.claws ]; then
47         chlog="ChangeLog-gtk2.claws"
48 else
49         chlog="ChangeLog.claws"
50 fi
51 echo -n "Is it ok (write to $chlog) [y/N]?"
52 read ans
53 if [ "$ans" == "y" ]; then
54         mv $chlog $chlog.old
55         echo -e -n $log > $chlog
56         cat $chlog.old >> $chlog
57         rm $chlog.old
58         echo "$patchset" >> PATCHSETS
59 fi