release-notes.pl: ignore dupes on input and output

Re-running this script now makes it track the already mentioned
changelog entries and not add them again even if the git log contains
them.

This makes the script better handle reruns in a release branch after
rebasing on a later version of master.

Closes #17937
This commit is contained in:
Daniel Stenberg 2025-07-15 17:43:57 +02:00
parent 48c6927f3b
commit 1962573a93
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View file

@ -61,16 +61,29 @@ my @releasenotes=`cat RELEASE-NOTES`;
my @o; # the entire new RELEASE-NOTES
my @refused; # [num] = [2 bits of use info]
my @refs; # [number] = [URL]
my %dupe;
for my $l (@releasenotes) {
if($l =~ /^ o .*\[(\d+)\]/) {
# referenced, set bit 0
$refused[$1]=1;
my $m = $l;
chomp $m;
$m =~ s/^ o //;
$m =~ s/ \[\d+\]$//;
$dupe{$m} = 1; # mark this as present
}
elsif($l =~ /^ \[(\d+)\] = (.*)/) {
# listed in a reference, set bit 1
$refused[$1] |= 2;
$refs[$1] = $2;
}
# mention without reference
elsif($l =~ /^ o (.*)/) {
my $m = $l;
chomp $m;
$m =~ s/^ o //;
$dupe{$m} = 1; # mark this as present
}
}
# Return a new fresh reference number
@ -156,6 +169,11 @@ sub onecommit {
my ($short)=@_;
my $ref;
if($dupe{$short}) {
# this git commit message was found in the file
return;
}
if($bug[0]) {
$ref = $bug[0];
}
@ -185,6 +203,11 @@ for my $l (@releasenotes) {
push @o, $l;
push @o, "\n";
for my $f (@line) {
if($dupe{$f}) {
# this item is already listed
next;
}
push @o, sprintf " o %s%s\n", $f,
$moreinfo{$f}? sprintf(" [%d]", $moreinfo{$f}): "";
$refused[$moreinfo{$f}]=3;