replace deprecated gtk_window_set_policy
[claws.git] / commitHelper
1 #!/bin/sh
2 head -16 configure.ac | grep VERSION= > /tmp/commitTool.tmp
3 source /tmp/commitTool.tmp
4 if [ -z "$EXTRA_GTK2_VERSION" ]; then
5         EXTRA_VERSION=`echo $EXTRA_VERSION | awk -F'.' '{for (i=1;i<NF;i++){printf $i"."};printf $NF+1}'`
6         nextsversion="${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}cvs${EXTRA_VERSION}"
7 else
8         EXTRA_GTK2_VERSION=`echo $EXTRA_GTK2_VERSION | awk -F'.' '{for (i=1;i<NF;i++){printf $i"."};printf $NF+1}'`
9         nextsversion="${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}cvs${EXTRA_VERSION}${EXTRA_GTK2_VERSION}"
10 fi
11 rm /tmp/commitTool.tmp
12
13 IFS='
14 '
15 filelist=`cvs status $@ 2>/dev/null |grep ^File`
16
17 for file in $filelist; do
18         merge=`echo $file | grep Merge`
19         modif=`echo $file | grep Locally`
20
21         if [ "$merge" != "" ]; then
22                 echo $merge
23                 echo You have to update first
24                 exit
25         fi;
26         if [ "$modif" != "" ]; then
27                 echo $modif
28         fi;
29 done;
30 patchset="("
31 log=""
32 files=`cvs diff -u $@ 2>/dev/null |grep ^Index`
33 echo "--8<----------"
34 name=`whoami`
35 #change if your login isn't your name
36 if [ "$name" == "claws" ]; then
37         name="paul";
38 fi;
39 if [ "$name" == "reboot" ]; then
40         name="christoph";
41 fi;
42
43 log="`date +%Y-%m-%d` [$name]\t$nextsversion\n\n"
44 for line in $files; do
45         file=`echo $line | cut -d' ' -f2`
46         dir=`dirname $file`
47         filename=`basename $file`
48         cvsfile="$dir/CVS/Entries"
49         version=`grep "\/$filename\/" $cvsfile | cut -d'/' -f3`
50         nextversion=`echo $version | awk -F'.' '{for (i=1;i<NF;i++){printf $i"."};printf $NF+1}'`
51         
52         log="$log\t* $file\n"
53         patchset="$patchset cvs diff -u -r $version -r $nextversion $file;\
54 "
55 done;
56 patchset="$patchset ) > $nextsversion.patchset"
57 log="$log\n"
58 echo -e -n $log
59 echo "--8<----------"
60 if [ -f ChangeLog-gtk2.claws ]; then
61         chlog="ChangeLog-gtk2.claws"
62 elif [ -f ChangeLog.claws ]; then
63         chlog="ChangeLog.claws"
64 else
65         chlog="ChangeLog"
66 fi
67 echo -n "Is it ok (write to $chlog) [y/N]?"
68 read ans
69 if [ "$ans" == "y" ]; then
70         mv $chlog $chlog.old
71         echo -e -n $log > $chlog
72         cat $chlog.old >> $chlog
73         rm $chlog.old
74         echo "$patchset" >> PATCHSETS
75         echo "editing $chlog configure.ac..."
76         if [ "$EDITOR" == "" ]; then
77                 EDITOR=vi
78         fi;
79         $EDITOR $chlog configure.ac
80         if [ "$@" != "" ]; then
81                 echo running cvs commit $@ PATCHSETS $chlog configure.ac
82                 cvs commit $@ PATCHSETS $chlog configure.ac
83         else
84                 echo running cvs commit
85                 cvs commit
86         fi;
87 fi