commitHelper 3.3 KB

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