Skip to content

Commit

Permalink
chore: teach release_notes.sh to identify PR ids out of merge commits
Browse files Browse the repository at this point in the history
Unfortunately, not all commit messages have PR ids, so need to try to get it out of merge commit

fixes pgjdbc#358
  • Loading branch information
vlsi committed Aug 6, 2015
1 parent e225dde commit f3214b1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions release_notes_filter.pl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/perl
use strict;

while(<>) {
if ($_ !~ /@@@/) {
Expand All @@ -10,9 +11,15 @@
my $sha = @c[1];
my $shortSha = @c[2];
my $body = `git log --format='%B' -n 1 $sha`;
my $mergeSha = `git log --reverse --ancestry-path --merges --format=%H $sha..HEAD | head -1`;
my $mergeSubject = `git log --format=%B -n 1 $mergeSha`;

my $pr = '';
if ($body =~ /(?:fix|fixes|close|closes) *#?(\d+)/) {
$pr = ' PR #'.$1;
}
if ($pr == '' && $mergeSubject =~ /Merge pull request #(\d+)/) {
$pr = ' PR #'.$1;
}
print $subject.$pr." (".$shortSha.")\n";
}

0 comments on commit f3214b1

Please sign in to comment.