commitHelper 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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}-stable"
  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. if [ "$name" == "hb" ]; then
  68. name="holger";
  69. fi;
  70. if [ "$name" == "salvatore" ]; then
  71. name="iwkse";
  72. fi;
  73. log="`date --utc +%Y-%m-%d` [$name]\t$nextsversion\n\n"
  74. for line in $files; do
  75. file=`echo $line | cut -d' ' -f2`
  76. dir=`dirname $file`
  77. filename=`basename $file`
  78. cvsfile="$dir/CVS/Entries"
  79. version=`grep "\/$filename\/" $cvsfile | cut -d'/' -f3`
  80. nextversion=`echo $version | awk -F'.' '{for (i=1;i<NF;i++){printf $i"."};printf $NF+1}'`
  81. log="$log\t* $file\n"
  82. if [ "$version" != "0" ]; then
  83. patchset="$patchset cvs diff -u -r $version -r $nextversion $file; "
  84. else
  85. patchset="$patchset diff -u /dev/null $file; "
  86. fi
  87. done;
  88. patchset="$patchset ) > $nextsversion.patchset"
  89. if [ "$CVSEDITOR" == "" ]; then
  90. if [ "$EDITOR" == "" ]; then
  91. if [ "$VISUAL" != "" ]; then
  92. EDITOR=$VISUAL
  93. else
  94. EDITOR=vi
  95. fi;
  96. fi;
  97. else
  98. EDITOR=$CVSEDITOR
  99. fi;
  100. echo -e "#please complete the changelog entry below" > /tmp/logentry.$$
  101. echo -e -n $log >> /tmp/logentry.$$
  102. $EDITOR /tmp/logentry.$$
  103. echo "--8<----------"
  104. grep -v "^#" /tmp/logentry.$$ > /tmp/log.tmp.$$ \
  105. && mv /tmp/log.tmp.$$ /tmp/logentry.$$
  106. echo >> /tmp/logentry.$$
  107. cat /tmp/logentry.$$
  108. chlog="ChangeLog"
  109. echo "--8<----------"
  110. echo -n "Is it ok (write to $chlog and update configure.ac) [y/N]?"
  111. read ans
  112. if [ "$ans" == "y" ]; then
  113. mv $chlog $chlog.old
  114. cat /tmp/logentry.$$ > $chlog
  115. cat $chlog.old >> $chlog
  116. rm $chlog.old
  117. cat configure.ac | sed "s/^EXTRA_VERSION=.*/EXTRA_VERSION=$nextextra/" > configure.ac.new \
  118. && mv configure.ac.new configure.ac ;
  119. echo "$patchset" >> PATCHSETS
  120. if [ "$args" != "" ]; then
  121. echo commiting $@ PATCHSETS $chlog configure.ac
  122. cvs commit -m "`cat /tmp/logentry.$$`" $@ PATCHSETS $chlog configure.ac
  123. else
  124. echo commiting recursively
  125. cvs commit -m "`cat /tmp/logentry.$$` "
  126. fi;
  127. rm -f /tmp/logentry.$$
  128. wget -O /dev/null -o /dev/null http://www.colino.net/sylpheed-claws/update.php3
  129. fi