commitHelper 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. #!/bin/bash
  2. args=`echo $@`
  3. head -n 16 configure.ac | grep VERSION= > /tmp/commitTool.tmp
  4. source /tmp/commitTool.tmp
  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. nextextra="$EXTRA_VERSION"
  8. nextextratype="head"
  9. rm /tmp/commitTool.tmp
  10. IFS='
  11. '
  12. filelist=`cvs status $@ configure.ac 2>/dev/null |grep ^File`
  13. for file in $filelist; do
  14. merge=`echo $file | grep Merge`
  15. modif=`echo $file | grep Locally`
  16. patch=`echo $file | grep Patch`
  17. if [ "$patch" != "" ]; then
  18. echo $patch
  19. echo You have to update first
  20. exit
  21. fi;
  22. if [ "$merge" != "" ]; then
  23. echo $merge
  24. echo You have to update first
  25. exit
  26. fi;
  27. if [ "$modif" != "" ]; then
  28. echo $modif
  29. fi;
  30. done;
  31. patchset="("
  32. log=""
  33. files=`cvs diff -uN $@ 2>/dev/null |grep ^Index`
  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. if [ "$name" == "leroyc" ]; then
  43. name="colin";
  44. fi;
  45. if [ "$name" == "torte" ]; then
  46. name="thorsten";
  47. fi;
  48. log="`date --utc +%Y-%m-%d` [$name]\t$nextsversion\n\n"
  49. for line in $files; do
  50. file=`echo $line | cut -d' ' -f2`
  51. dir=`dirname $file`
  52. filename=`basename $file`
  53. cvsfile="$dir/CVS/Entries"
  54. version=`grep "\/$filename\/" $cvsfile | cut -d'/' -f3`
  55. nextversion=`echo $version | awk -F'.' '{for (i=1;i<NF;i++){printf $i"."};printf $NF+1}'`
  56. log="$log\t* $file\n"
  57. if [ "$version" != "0" ]; then
  58. patchset="$patchset cvs diff -u -r $version -r $nextversion $file; "
  59. else
  60. patchset="$patchset diff -u /dev/null $file; "
  61. fi
  62. done;
  63. patchset="$patchset ) > $nextsversion.patchset"
  64. if [ "$EDITOR" == "" ]; then
  65. EDITOR=vi
  66. fi;
  67. echo -e "#please complete the changelog entry below" > /tmp/logentry
  68. echo -e -n $log >> /tmp/logentry
  69. $EDITOR /tmp/logentry
  70. echo "--8<----------"
  71. grep -v "^#" /tmp/logentry > /tmp/log.tmp.$$ \
  72. && mv /tmp/log.tmp.$$ /tmp/logentry
  73. echo >> /tmp/logentry
  74. cat /tmp/logentry
  75. echo "--8<----------"
  76. if [ -f ChangeLog-gtk2.claws ]; then
  77. chlog="ChangeLog-gtk2.claws"
  78. elif [ -f ChangeLog.claws ]; then
  79. chlog="ChangeLog.claws"
  80. else
  81. chlog="ChangeLog"
  82. fi
  83. echo -n "Is it ok (write to $chlog and update configure.ac) [y/N]?"
  84. read ans
  85. if [ "$ans" == "y" ]; then
  86. mv $chlog $chlog.old
  87. cat /tmp/logentry > $chlog
  88. cat $chlog.old >> $chlog
  89. rm $chlog.old
  90. cat configure.ac | sed "s/^EXTRA_VERSION=.*/EXTRA_VERSION=$nextextra/" > configure.ac.new \
  91. && mv configure.ac.new configure.ac ;
  92. echo "$patchset" >> PATCHSETS
  93. if [ "$args" != "" ]; then
  94. echo commiting $@ PATCHSETS $chlog configure.ac
  95. cvs commit -m "`cat /tmp/logentry`" $@ PATCHSETS $chlog configure.ac
  96. else
  97. echo commiting recursively
  98. cvs commit -m "`cat /tmp/logentry` "
  99. fi;
  100. rm -f /tmp/logentry
  101. wget -O /dev/null -o /dev/null http://www.colino.net/sylpheed-claws-gtk2/update.php3
  102. fi