2
0

log2changes.pl 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #!/usr/bin/env perl
  2. #***************************************************************************
  3. # _ _ ____ _
  4. # Project ___| | | | _ \| |
  5. # / __| | | | |_) | |
  6. # | (__| |_| | _ <| |___
  7. # \___|\___/|_| \_\_____|
  8. #
  9. # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
  10. #
  11. # This software is licensed as described in the file COPYING, which
  12. # you should have received as part of this distribution. The terms
  13. # are also available at https://curl.se/docs/copyright.html.
  14. #
  15. # You may opt to use, copy, modify, merge, publish, distribute and/or sell
  16. # copies of the Software, and permit persons to whom the Software is
  17. # furnished to do so, under the terms of the COPYING file.
  18. #
  19. # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  20. # KIND, either express or implied.
  21. #
  22. # SPDX-License-Identifier: curl
  23. #
  24. ###########################################################################
  25. # git log --pretty=fuller --no-color --date=short --decorate=full
  26. my @mname = ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
  27. 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' );
  28. sub nicedate {
  29. my ($date)=$_;
  30. if($date =~ /(\d\d\d\d)-(\d\d)-(\d\d)/) {
  31. return sprintf("%d %s %4d", $3, $mname[$2-1], $1);
  32. }
  33. return $date;
  34. }
  35. sub printmsg {
  36. my ($p, $msg)=@_;
  37. while(length($msg) > 77) {
  38. print $p.substr($msg, 0, 77, "")."\n";
  39. $p=" ";
  40. }
  41. if($msg eq "") {
  42. $p = "";
  43. }
  44. print "$p$msg\n";
  45. }
  46. print
  47. ' _ _ ____ _
  48. ___| | | | _ \| |
  49. / __| | | | |_) | |
  50. | (__| |_| | _ <| |___
  51. \___|\___/|_| \_\_____|
  52. Changelog
  53. ';
  54. my $tag;
  55. while(<STDIN>) {
  56. my $l = $_;
  57. if($l =~/^commit ([[:xdigit:]]*) ?(.*)/) {
  58. $co = $1;
  59. my $ref = $2;
  60. if ($ref =~ /refs\/tags\/curl-([0-9_]*)/) {
  61. $tag = $1;
  62. $tag =~ tr/_/./;
  63. }
  64. }
  65. elsif($l =~ /^Author: *(.*) +</) {
  66. $c = $1;
  67. }
  68. elsif($l =~ /^CommitDate: (.*)/) {
  69. $date = nicedate($1);
  70. }
  71. elsif($l =~ /^( )(.*)/) {
  72. my $pref = " ";
  73. if ($tag) {
  74. # Version entries have a special format
  75. print "\nVersion " . $tag." ($date)\n";
  76. $oldc = "";
  77. $tag = "";
  78. }
  79. if($co ne $oldco) {
  80. if($c ne $oldc) {
  81. print "\n$c ($date)\n\n";
  82. }
  83. else {
  84. print "\n";
  85. }
  86. $pref = "- ";
  87. }
  88. $oldco = $co;
  89. $oldc = $c;
  90. $olddate = $date;
  91. printmsg($pref, $2);
  92. }
  93. }