From 8473b7f95fbe8ef25dccd23ff94a4e363797bd90 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 1 May 2016 11:24:32 -0400 Subject: [PATCH] Add a --non-master-only option to git_changelog. This has the inverse effect of --master-only. It's needed to help find cases where a commit should not be described in major release notes because it was back-patched into older branches, though not at the same time as the HEAD commit. --- src/tools/git_changelog | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/src/tools/git_changelog b/src/tools/git_changelog index 031772158e..8d77016227 100755 --- a/src/tools/git_changelog +++ b/src/tools/git_changelog @@ -37,6 +37,14 @@ # git show $(git merge-base REL9_5_STABLE master) # where the branch to mention is the previously forked-off branch. This # shows the last commit before that branch was made. +# +# Note that --master-only is an imperfect filter, since it will not detect +# cases where a HEAD patch was back-patched awhile later or with a slightly +# different commit message. To find such cases, it's a good idea to look +# through the output of +# git_changelog --non-master-only --oldest-first --since='start-date' +# and then remove anything from the --master-only output that would be +# duplicative. use strict; @@ -62,6 +70,7 @@ my $brief = 0; my $details_after = 0; my $post_date = 0; my $master_only = 0; +my $non_master_only = 0; my $oldest_first = 0; my $since; my @output_buffer; @@ -71,6 +80,7 @@ Getopt::Long::GetOptions( 'brief' => \$brief, 'details-after' => \$details_after, 'master-only' => \$master_only, + 'non-master-only' => \$non_master_only, 'post-date' => \$post_date, 'oldest-first' => \$oldest_first, 'since=s' => \$since) || usage(); @@ -236,10 +246,21 @@ while (1) my $winner = $all_commits_by_branch{$best_branch}->[ $position{$best_branch} ]; - # check for master-only - if (!$master_only - || ($winner->{'commits'}[0]->{'branch'} eq 'master' - && @{ $winner->{'commits'} } == 1)) + my $print_it = 1; + if ($master_only) + { + $print_it = (@{ $winner->{'commits'} } == 1) + && ($winner->{'commits'}[0]->{'branch'} eq 'master'); + } + elsif ($non_master_only) + { + foreach my $c (@{ $winner->{'commits'} }) + { + $print_it = 0 if ($c->{'branch'} eq 'master'); + } + } + + if ($print_it) { output_details($winner) if (!$details_after); output_str("%s", $winner->{'message'} . "\n"); @@ -375,13 +396,14 @@ sub output_details sub usage { print STDERR <