commitHelper 3.2 KB

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