log2changes.pl: wrap long lines at 80 columns

Also, only use author names in the output.

Fixes #9896
Reported-by: John Sherrill
Closes #9897
This commit is contained in:
Daniel Stenberg 2022-11-12 00:07:34 +01:00
parent f4912407eb
commit 980510926d
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -37,6 +37,18 @@ sub nicedate {
return $date; return $date;
} }
sub printmsg {
my ($p, $msg)=@_;
while(length($msg) > 77) {
print $p.substr($msg, 0, 77, "")."\n";
$p=" ";
}
if($msg eq "") {
$p = "";
}
print "$p$msg\n";
}
print print
' _ _ ____ _ ' _ _ ____ _
___| | | | _ \| | ___| | | | _ \| |
@ -47,7 +59,6 @@ print
Changelog Changelog
'; ';
my $line;
my $tag; my $tag;
while(<STDIN>) { while(<STDIN>) {
my $l = $_; my $l = $_;
@ -61,44 +72,32 @@ while(<STDIN>) {
} }
} }
elsif($l =~ /^Author: *(.*) +</) { elsif($l =~ /^Author: *(.*) +</) {
$a = $1;
}
elsif($l =~ /^Commit: *(.*) +</) {
$c = $1; $c = $1;
} }
elsif($l =~ /^CommitDate: (.*)/) { elsif($l =~ /^CommitDate: (.*)/) {
$date = nicedate($1); $date = nicedate($1);
} }
elsif($l =~ /^( )(.*)/) { elsif($l =~ /^( )(.*)/) {
my $extra; my $pref = " ";
if ($tag) { if ($tag) {
# Version entries have a special format # Version entries have a special format
print "\nVersion " . $tag." ($date)\n"; print "\nVersion " . $tag." ($date)\n";
$oldc = ""; $oldc = "";
$tag = ""; $tag = "";
} }
if($a ne $c) {
$extra=sprintf("\n- [%s brought this change]\n\n ", $a);
}
else {
$extra="\n- ";
}
if($co ne $oldco) { if($co ne $oldco) {
if($c ne $oldc) { if($c ne $oldc) {
print "\n$c ($date)$extra"; print "\n$c ($date)\n\n";
} }
else { else {
print "$extra"; print "\n";
} }
$line =0; $pref = "- ";
} }
$oldco = $co; $oldco = $co;
$oldc = $c; $oldc = $c;
$olddate = $date; $olddate = $date;
if($line++ && $2 ne "") { printmsg($pref, $2);
print " ";
}
print $2."\n";
} }
} }