commitHelper 3.5 KB

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