head	1.2;
access;
symbols
	RELENG_4_11_0_RELEASE:1.1.1.1
	RELENG_4_11:1.1.1.1.0.24
	RELENG_4_11_BP:1.1.1.1
	RELENG_4_10_0_RELEASE:1.1.1.1
	RELENG_4_10:1.1.1.1.0.22
	RELENG_4_10_BP:1.1.1.1
	RELENG_4_9_0_RELEASE:1.1.1.1
	RELENG_4_9:1.1.1.1.0.20
	RELENG_4_9_BP:1.1.1.1
	RELENG_4_8_0_RELEASE:1.1.1.1
	RELENG_4_8:1.1.1.1.0.18
	RELENG_4_8_BP:1.1.1.1
	RELENG_4_7_0_RELEASE:1.1.1.1
	RELENG_4_7:1.1.1.1.0.16
	RELENG_4_7_BP:1.1.1.1
	RELENG_4_6_2_RELEASE:1.1.1.1
	RELENG_4_6_1_RELEASE:1.1.1.1
	RELENG_4_6_0_RELEASE:1.1.1.1
	RELENG_4_6:1.1.1.1.0.14
	RELENG_4_6_BP:1.1.1.1
	v5_006_01:1.1.1.3
	RELENG_4_5_0_RELEASE:1.1.1.1
	RELENG_4_5:1.1.1.1.0.12
	RELENG_4_5_BP:1.1.1.1
	RELENG_4_4_0_RELEASE:1.1.1.1
	RELENG_4_4:1.1.1.1.0.10
	RELENG_4_4_BP:1.1.1.1
	RELENG_4_3_0_RELEASE:1.1.1.1
	RELENG_4_3:1.1.1.1.0.8
	RELENG_4_3_BP:1.1.1.1
	RELENG_4_2_0_RELEASE:1.1.1.1
	RELENG_4_1_1_RELEASE:1.1.1.1
	PRE_SMPNG:1.1.1.2
	RELENG_4_1_0_RELEASE:1.1.1.1
	v5_006:1.1.1.2
	RELENG_3_5_0_RELEASE:1.1.1.1
	RELENG_4_0_0_RELEASE:1.1.1.1
	RELENG_4:1.1.1.1.0.6
	RELENG_4_BP:1.1.1.1
	RELENG_3_4_0_RELEASE:1.1.1.1
	RELENG_3_3_0_RELEASE:1.1.1.1
	RELENG_3_2_PAO:1.1.1.1.0.4
	RELENG_3_2_PAO_BP:1.1.1.1
	RELENG_3_2_0_RELEASE:1.1.1.1
	v5_005_03:1.1.1.1
	RELENG_3_1_0_RELEASE:1.1.1.1
	RELENG_3:1.1.1.1.0.2
	RELENG_3_BP:1.1.1.1
	RELENG_3_0_0_RELEASE:1.1.1.1
	v5_005_02:1.1.1.1
	LWALL:1.1.1;
locks; strict;
comment	@# @;


1.2
date	2002.05.16.10.07.48;	author markm;	state dead;
branches;
next	1.1;

1.1
date	98.09.09.06.59.49;	author markm;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	98.09.09.06.59.49;	author markm;	state Exp;
branches;
next	1.1.1.2;

1.1.1.2
date	2000.06.25.11.03.01;	author markm;	state Exp;
branches;
next	1.1.1.3;

1.1.1.3
date	2002.03.16.20.13.56;	author markm;	state Exp;
branches;
next	;


desc
@@


1.2
log
@Perl is no longer in base. Long live the port!
@
text
@#!/l/local/bin/perl -w
#
# Generate a nice changelist by querying perforce.
#
# Each change is described with the change number, description,
# which branch the change happened in, files modified,
# and who was responsible for entering the change.
#
# Can be called with a list of change numbers or a range of the
# form "12..42".  Changelog will be printed from highest number
# to lowest.
#
# Outputs the changelist to stdout.
#
# Gurusamy Sarathy <gsar@@umich.edu>
#

use Text::Wrap;

$0 =~ s|^.*/||;
unless (@@ARGV) {
    die <<USAGE;
        $0 [-p \$P4PORT] <change numbers or from..to>
USAGE
}

my @@changes;

my %editkind;
@@editkind{ qw(   add      edit    delete integrate   branch )}
         = qw(     +         !         -        !>       +> );

my $p4port = $ENV{P4PORT} || 'localhost:1666';

while (@@ARGV) {
    $_ = shift;
    if (/^(\d+)\.\.(\d+)$/) {
        push @@changes, $1 .. $2;
    }
    elsif (/^\d+$/) {
        push @@changes, $_;
    }
    elsif (/^-p(.*)$/) {
        $p4port = $1 || shift;
    }
    else {
        warn "Arguments must be change numbers, ignoring `$_'\n";
    }
}

@@changes = sort { $b <=> $a } @@changes;

my @@desc = `p4 -p $p4port describe -s @@changes`;
if ($?) {
    die "$0: `p4 -p $p4port describe -s @@changes` failed, status[$?]\n";
}
else {
    chomp @@desc;
    while (@@desc) {
	my ($change,$who,$date,$time,@@log,$branch,$file,$type,%files);
	$_ = shift @@desc;
	if (/^Change (\d+) by (\w+)\@@.+ on (\S+) (\S+)\s*$/) {
	    ($change, $who, $date, $time) = ($1,$2,$3,$4);
	    $_ = shift @@desc;  # get rid of empty line
	    while (@@desc) {
	        $_ = shift @@desc;
		last if /^Affected/;
		push @@log, $_;    
	    }
	    if (/^Affected/) {
		$_ = shift @@desc;  # get rid of empty line
		while ($_ = shift @@desc) {
		    last unless /^\.\.\./;
		    if (m{^\.\.\. //depot/(.*?perl|[^/]*)/([^#]+)#\d+ (\w+)\s*$}) {
			($branch,$file,$type) = ($1,$2,$3);
			$files{$branch} = {} unless exists $files{$branch};
			$files{$branch}{$type} = [] unless exists $files{$branch}{$type};
			push @@{$files{$branch}{$type}}, $file;
		    }
		    else {
			warn "Unknown line [$_], ignoring\n";
		    }
		}
	    }
	}
	next unless $change;
	print "_" x 76, "\n";
	printf <<EOT, $change, $who, $date, $time;
[%6s] By: %-25s             on %9s %9s
EOT
	print "        Log: ";
	my $i = 0;
	while (@@log) {
	    $_ = shift @@log;
	    s/^\s*//;
	    s/^\[.*\]\s*// unless $i ;
            # don't print last empty line
	    if ($_ or @@log) {
	        print "             " if $i++;
	        print "$_\n";
	    }
	}
	for my $branch (sort keys %files) {
	    printf "%11s: $branch\n", 'Branch';
	    for my $kind (sort keys %{$files{$branch}}) {
	        warn("### $kind ###\n"), next unless exists $editkind{$kind};
		my $files = $files{$branch}{$kind};
		# don't show large branches and integrations
		$files = ["($kind " . scalar(@@$files) . ' files)']
		    if (@@$files > 25
		        && ( $kind eq 'integrate' || $kind eq 'branch'));
	        print wrap(sprintf("%12s ", $editkind{$kind}),
			   sprintf("%12s ", $editkind{$kind}),
			   "@@$files\n");
            }
	}
    }
}
@


1.1
log
@Initial revision
@
text
@@


1.1.1.1
log
@Initial import of Perl5. The king is dead; long live the king!
@
text
@@


1.1.1.2
log
@Vendor import of Perl 5.006
@
text
@d15 1
a15 1
# Gurusamy Sarathy <gsar@@activestate.com>
d110 2
a111 3
		    if (@@$files > 25 && ($kind eq 'integrate'
		    			 || $kind eq 'branch'))
		       || @@$files > 100;
@


1.1.1.3
log
@Vendor import Perl 5.6.1
@
text
@d23 1
a23 1
        $0 [-p \$P4PORT] [-bi branch_include] [-be branch_exclude] <change numbers or from..to>
a34 5
my @@branch_include;
my @@branch_exclude;
my %branch_include;
my %branch_exclude;

a45 6
    elsif (/^-bi(.*)$/) {
        push @@branch_include, $1 || shift;
    }
    elsif (/^-be(.*)$/) {
        push @@branch_exclude, $1 || shift;
    }
a52 3
@@branch_include{@@branch_include} = @@branch_include if @@branch_include;
@@branch_exclude{@@branch_exclude} = @@branch_exclude if @@branch_exclude;

a60 2
	my $skip = 0;
        my $nbranch = 0;
a75 6
 		        $nbranch++;
		        if (exists $branch_exclude{$branch} or
			    @@branch_include and
			    not exists $branch_include{$branch}) {
			    $skip++;
			}
d86 1
a86 1
	next if not $change or $skip == $nbranch;
@


