commitHelper 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. #!/bin/bash
  2. args=`echo $@`
  3. tmpfile=${0##*/}.tmp
  4. head -n 16 configure.ac | grep VERSION= > $tmpfile
  5. source $tmpfile
  6. EXTRA_VERSION=`echo $EXTRA_VERSION | awk -F'.' '{for (i=1;i<NF;i++){printf $i"."};printf $NF+1}'`
  7. nextsversion="${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}cvs${EXTRA_VERSION}${EXTRA_GTK2_VERSION}"
  8. nextextra="$EXTRA_VERSION"
  9. nextextratype="head"
  10. rm -f $tmpfile
  11. IFS='
  12. '
  13. filelist=`cvs status $@ configure.ac 2>/dev/null |grep ^File`
  14. for file in $filelist; do
  15. merge=`echo $file | grep Merge`
  16. modif=`echo $file | grep Locally`
  17. patch=`echo $file | grep Patch`
  18. if [ "$patch" != "" ]; then
  19. echo $patch
  20. echo You have to update first
  21. exit
  22. fi;
  23. if [ "$merge" != "" ]; then
  24. echo $merge
  25. echo You have to update first
  26. exit
  27. fi;
  28. if [ "$modif" != "" ]; then
  29. echo $modif
  30. fi;
  31. done;
  32. patchset="("
  33. log=""
  34. files=`cvs diff -uN $@ 2>$tmpfile |grep ^Index`
  35. if [ "$files" == "" ]; then
  36. echo Nothing to commit\!
  37. if [ -s $tmpfile ]; then
  38. echo See possible reason below:
  39. cat $tmpfile
  40. fi
  41. exit
  42. fi
  43. rm -f $tmpfile
  44. name=`whoami`
  45. #change if your login isn't your name
  46. if [ "$name" == "claws" ]; then
  47. name="paul";
  48. fi;
  49. if [ "$name" == "leroyc" ]; then
  50. name="colin";
  51. fi;
  52. if [ "$name" == "torte" ]; then
  53. name="thorsten";
  54. fi;
  55. if [ "$name" == "dinh" ]; then
  56. name="hoa";
  57. fi;
  58. if [ "$name" == "f" -o "$name" == "darkok" ]; then
  59. name="darko";
  60. fi;
  61. if [ "$name" == "msp" ]; then
  62. name="martin";
  63. fi;
  64. if [ "$name" == "devel" ]; then
  65. name="mones";
  66. fi;
  67. log="`date --utc +%Y-%m-%d` [$name]\t$nextsversion\n\n"
  68. for line in $files; do
  69. file=`echo $line | cut -d' ' -f2`
  70. dir=`dirname $file`
  71. filename=`basename $file`
  72. cvsfile="$dir/CVS/Entries"
  73. version=`grep "\/$filename\/" $cvsfile | cut -d'/' -f3`
  74. nextversion=`echo $version | awk -F'.' '{for (i=1;i<NF;i++){printf $i"."};printf $NF+1}'`
  75. log="$log\t* $file\n"
  76. if [ "$version" != "0" ]; then
  77. patchset="$patchset cvs diff -u -r $version -r $nextversion $file; "
  78. else
  79. patchset="$patchset diff -u /dev/null $file; "
  80. fi
  81. done;
  82. patchset="$patchset ) > $nextsversion.patchset"
  83. if [ "$EDITOR" == "" ]; then
  84. if [ "$VISUAL" != "" ]; then
  85. EDITOR=$VISUAL
  86. else
  87. EDITOR=vi
  88. fi;
  89. fi;
  90. echo -e "#please complete the changelog entry below" > /tmp/logentry
  91. echo -e -n $log >> /tmp/logentry
  92. [ -f commitHelper.msg ] && cat commitHelper.msg >>/tmp/logentry
  93. $EDITOR /tmp/logentry
  94. echo "--8<----------"
  95. grep -v "^#" /tmp/logentry > /tmp/log.tmp.$$ \
  96. && mv /tmp/log.tmp.$$ /tmp/logentry
  97. echo >> /tmp/logentry
  98. cat /tmp/logentry
  99. chlog="ChangeLog"
  100. echo "--8<----------"
  101. echo -n "Is it ok (write to $chlog and update configure.ac) [y/N]?"
  102. read ans
  103. if [ "$ans" == "y" ]; then
  104. mv $chlog $chlog.old
  105. cat /tmp/logentry > $chlog
  106. cat $chlog.old >> $chlog
  107. rm $chlog.old
  108. cat configure.ac | sed "s/^EXTRA_VERSION=.*/EXTRA_VERSION=$nextextra/" > configure.ac.new \
  109. && mv configure.ac.new configure.ac ;
  110. echo "$patchset" >> PATCHSETS
  111. if [ "$args" != "" ]; then
  112. echo commiting $@ PATCHSETS $chlog configure.ac
  113. cvs commit -m "`cat /tmp/logentry`" $@ PATCHSETS $chlog configure.ac
  114. else
  115. echo commiting recursively
  116. cvs commit -m "`cat /tmp/logentry` "
  117. fi;
  118. rm -f /tmp/logentry
  119. wget -O /dev/null -o /dev/null http://www.colino.net/sylpheed-claws-gtk2/update.php3
  120. fi