X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=Porting%2Fgenlog;h=9926b37e7007edaacbf462bc4905db79cdf53553;hb=e40b81a3dd247b1a29fc78399677b77b78b5f183;hp=efb7ef8e108d4a04ad41696388153ace2822fc10;hpb=1d7c184104c076988718a01b77c8706aae05b092;p=p5sagit%2Fp5-mst-13.2.git diff --git a/Porting/genlog b/Porting/genlog index efb7ef8..9926b37 100755 --- a/Porting/genlog +++ b/Porting/genlog @@ -1,4 +1,4 @@ -#!/l/local/bin/perl -w +#!/usr/bin/perl -w # # Generate a nice changelist by querying perforce. # @@ -20,7 +20,7 @@ use Text::Wrap; $0 =~ s|^.*/||; unless (@ARGV) { die < + $0 [-p \$P4PORT] [-bi branch_include] [-be branch_exclude] USAGE } @@ -32,10 +32,15 @@ my %editkind; my $p4port = $ENV{P4PORT} || 'localhost:1666'; +my @branch_include; +my @branch_exclude; +my %branch_include; +my %branch_exclude; + while (@ARGV) { $_ = shift; - if (/^(\d+)\.\.(\d+)$/) { - push @changes, $1 .. $2; + if (/^(\d+)\.\.(\d+)?$/) { + push @changes, $1 .. ($2 || (split(' ', `p4 changes -m 1`))[1]); } elsif (/^\d+$/) { push @changes, $_; @@ -43,6 +48,12 @@ while (@ARGV) { elsif (/^-p(.*)$/) { $p4port = $1 || shift; } + elsif (/^-bi(.*)$/) { + push @branch_include, $1 || shift; + } + elsif (/^-be(.*)$/) { + push @branch_exclude, $1 || shift; + } else { warn "Arguments must be change numbers, ignoring `$_'\n"; } @@ -50,14 +61,20 @@ while (@ARGV) { @changes = sort { $b <=> $a } @changes; +@branch_include{@branch_include} = @branch_include if @branch_include; +@branch_exclude{@branch_exclude} = @branch_exclude if @branch_exclude; + my @desc = `p4 -p $p4port describe -s @changes`; if ($?) { die "$0: `p4 -p $p4port describe -s @changes` failed, status[$?]\n"; } else { + tr/\r/\n/ foreach @desc; chomp @desc; while (@desc) { my ($change,$who,$date,$time,@log,$branch,$file,$type,%files); + my $skip = 0; + my $nbranch = 0; $_ = shift @desc; if (/^Change (\d+) by (\w+)\@.+ on (\S+) (\S+)\s*$/) { ($change, $who, $date, $time) = ($1,$2,$3,$4); @@ -73,6 +90,12 @@ else { last unless /^\.\.\./; if (m{^\.\.\. //depot/(.*?perl|[^/]*)/([^#]+)#\d+ (\w+)\s*$}) { ($branch,$file,$type) = ($1,$2,$3); + $nbranch++; + if (exists $branch_exclude{$branch} or + @branch_include and + not exists $branch_include{$branch}) { + $skip++; + } $files{$branch} = {} unless exists $files{$branch}; $files{$branch}{$type} = [] unless exists $files{$branch}{$type}; push @{$files{$branch}{$type}}, $file; @@ -83,7 +106,7 @@ else { } } } - next unless $change; + next if ((not $change) or $skip); print "_" x 76, "\n"; printf <