13 sub edit_change_log
() {
15 open my $f, '<', $file or die ("Failed to open file: $file\n");
16 my $logmsg = read_file
($f);
18 # We do a bunch of munging on the log message here,
19 # particularly for logs that are formatted in a ChangeLog
22 my $origlog = $logmsg;
26 # print "original: $logmsg\n";
28 # Kill initial date/name stamp: YYYY-MM-DD First Last <email@example.com>
30 $logmsg =~ s
|^\s
*\d\d
*-\d\d
*-\d\d
*\s
*[^<\n]*<[^>\n]*>\s
*$|* \n|mg
;
32 # Strip out nickle version numbers
33 $logmsg =~ s
|^(version
)?
2.\d\d
*$||mg
;
35 # Remove initial space for each line
36 $logmsg =~ s
|^[ \t]+||mg
;
38 # Collapse space sequences
39 $logmsg =~ s
|[ \t]+| |g
;
42 $logmsg =~ s
|([^\n])\n([^0-9*+\
-\n])|$1 $2|g
;
44 my @lines = split (/\n/, $logmsg);
50 foreach my $line (@lines) {
51 # find lines begining with '*'
52 if ($line =~ /^reviewed by:\s*/) {
53 if ($line !~ /<delete if not using/) {
54 $reviews = $reviews . "\n" . $line;
57 if ($line =~ s/^\*\s\s*//) {
59 $line =~ s/^[^:]*:\s*//;
60 # strip off function names
61 while ($line =~ s/^\([^)]*\)[,:]*\s*// ) {
64 # Remove initial space for each line
65 $line =~ s
|^[ \t+]+||;
67 # Collapse space sequences
68 $line =~ s
|[ \t]+| |g
;
73 $line = Text
::Wrap
::wrap
("", " ", $line);
75 $logmsg = $logmsg . $line . "\n";
78 $logmsg = $logmsg . $reviews;
80 # Trim initial newlines
83 # collapse sequences of newlines
84 $logmsg =~ s/\n\n*/\n/g;
86 # Remove trailing whitespace
87 $logmsg =~ s/[\s\n]+\z//;
90 $logmsg .= "\n\n\nSKIPPED:\n\t";
91 $logmsg .= join("\n\t", @skipped) . "\n";
94 open my $f, '>', $file or die ("Failed to open file: $file\n");