commitHelper 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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}"
  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 [ "$CVSEDITOR" == "" ]; then
  84. if [ "$EDITOR" == "" ]; then
  85. if [ "$VISUAL" != "" ]; then
  86. EDITOR=$VISUAL
  87. else
  88. EDITOR=vi
  89. fi;
  90. fi;
  91. else
  92. EDITOR=$CVSEDITOR
  93. fi;
  94. echo -e "#please complete the changelog entry below" > /tmp/logentry.$$
  95. echo -e -n $log >> /tmp/logentry.$$
  96. $EDITOR /tmp/logentry.$$
  97. echo "--8<----------"
  98. grep -v "^#" /tmp/logentry.$$ > /tmp/log.tmp.$$ \
  99. && mv /tmp/log.tmp.$$ /tmp/logentry.$$
  100. echo >> /tmp/logentry.$$
  101. cat /tmp/logentry.$$
  102. chlog="ChangeLog"
  103. echo "--8<----------"
  104. echo -n "Is it ok (write to $chlog and update configure.ac) [y/N]?"
  105. read ans
  106. if [ "$ans" == "y" ]; then
  107. mv $chlog $chlog.old
  108. cat /tmp/logentry.$$ > $chlog
  109. cat $chlog.old >> $chlog
  110. rm $chlog.old
  111. cat configure.ac | sed "s/^EXTRA_VERSION=.*/EXTRA_VERSION=$nextextra/" > configure.ac.new \
  112. && mv configure.ac.new configure.ac ;
  113. echo "$patchset" >> PATCHSETS
  114. if [ "$args" != "" ]; then
  115. echo commiting $@ PATCHSETS $chlog configure.ac
  116. cvs commit -m "`cat /tmp/logentry.$$`" $@ PATCHSETS $chlog configure.ac
  117. else
  118. echo commiting recursively
  119. cvs commit -m "`cat /tmp/logentry.$$` "
  120. fi;
  121. rm -f /tmp/logentry.$$
  122. wget -O /dev/null -o /dev/null http://www.colino.net/sylpheed-claws/update.php3
  123. fi