37
37
# git show $(git merge-base REL9_5_STABLE master)
38
38
# where the branch to mention is the previously forked-off branch. This
39
39
# shows the last commit before that branch was made.
40
+ #
41
+ # Note that --master-only is an imperfect filter, since it will not detect
42
+ # cases where a HEAD patch was back-patched awhile later or with a slightly
43
+ # different commit message. To find such cases, it's a good idea to look
44
+ # through the output of
45
+ # git_changelog --non-master-only --oldest-first --since='start-date'
46
+ # and then remove anything from the --master-only output that would be
47
+ # duplicative.
40
48
41
49
42
50
use strict;
@@ -62,6 +70,7 @@ my $brief = 0;
62
70
my $details_after = 0;
63
71
my $post_date = 0;
64
72
my $master_only = 0;
73
+ my $non_master_only = 0;
65
74
my $oldest_first = 0;
66
75
my $since ;
67
76
my @output_buffer ;
@@ -71,6 +80,7 @@ Getopt::Long::GetOptions(
71
80
' brief' => \$brief ,
72
81
' details-after' => \$details_after ,
73
82
' master-only' => \$master_only ,
83
+ ' non-master-only' => \$non_master_only ,
74
84
' post-date' => \$post_date ,
75
85
' oldest-first' => \$oldest_first ,
76
86
' since=s' => \$since ) || usage();
@@ -236,10 +246,21 @@ while (1)
236
246
my $winner =
237
247
$all_commits_by_branch {$best_branch }-> [ $position {$best_branch } ];
238
248
239
- # check for master-only
240
- if (!$master_only
241
- || ($winner -> {' commits' }[0]-> {' branch' } eq ' master'
242
- && @{ $winner -> {' commits' } } == 1))
249
+ my $print_it = 1;
250
+ if ($master_only )
251
+ {
252
+ $print_it = (@{ $winner -> {' commits' } } == 1)
253
+ && ($winner -> {' commits' }[0]-> {' branch' } eq ' master' );
254
+ }
255
+ elsif ($non_master_only )
256
+ {
257
+ foreach my $c (@{ $winner -> {' commits' } })
258
+ {
259
+ $print_it = 0 if ($c -> {' branch' } eq ' master' );
260
+ }
261
+ }
262
+
263
+ if ($print_it )
243
264
{
244
265
output_details($winner ) if (!$details_after );
245
266
output_str(" %s " , $winner -> {' message' } . " \n " );
@@ -375,13 +396,14 @@ sub output_details
375
396
sub usage
376
397
{
377
398
print STDERR <<EOM ;
378
- Usage: git_changelog [--brief/-b] [--details-after/-d] [--master-only/-m] [--oldest-first/-o] [--post-date/-p] [--since=SINCE]
399
+ Usage: git_changelog [--brief/-b] [--details-after/-d] [--master-only/-m] [--non-master-only/-n] [-- oldest-first/-o] [--post-date/-p] [--since=SINCE]
379
400
--brief Shorten commit descriptions, omitting branch identification
380
401
--details-after Show branch and author info after the commit description
381
- --master-only Show commits made exclusively to the master branch
402
+ --master-only Show only commits made just in the master branch
403
+ --non-master-only Show only commits made just in back branches
382
404
--oldest-first Show oldest commits first
383
405
--post-date Show branches made after a commit occurred
384
- --since Print only commits dated since SINCE
406
+ --since Show only commits dated since SINCE
385
407
EOM
386
408
exit 1;
387
409
}
0 commit comments