check-pullups.pl revision 65dfcdc392b93f9d67684adce8b33a1d8168e67c
380c874925f684847d9278b909cf511cb5b0289aShawn Routhier#!/usr/bin/perl
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews#
380c874925f684847d9278b909cf511cb5b0289aShawn Routhier# Given two CHANGES files, list [bug] entries present in the
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# first one but not in the second one.
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews#
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews
380c874925f684847d9278b909cf511cb5b0289aShawn Routhieruse FileHandle;
380c874925f684847d9278b909cf511cb5b0289aShawn Routhier
380c874925f684847d9278b909cf511cb5b0289aShawn Routhier$/ = "";
380c874925f684847d9278b909cf511cb5b0289aShawn Routhier
380c874925f684847d9278b909cf511cb5b0289aShawn Routhier# Read the CHANGES file $fn and return a hash of change
380c874925f684847d9278b909cf511cb5b0289aShawn Routhier# texts and categories indexed by change number.
380c874925f684847d9278b909cf511cb5b0289aShawn Routhier
380c874925f684847d9278b909cf511cb5b0289aShawn Routhiersub readfile {
380c874925f684847d9278b909cf511cb5b0289aShawn Routhier my ($fn) = @_;
380c874925f684847d9278b909cf511cb5b0289aShawn Routhier my $fh = new FileHandle($fn, "r")
380c874925f684847d9278b909cf511cb5b0289aShawn Routhier or die "open: $fn: $!";
380c874925f684847d9278b909cf511cb5b0289aShawn Routhier
380c874925f684847d9278b909cf511cb5b0289aShawn Routhier my $changes = { };
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews
380c874925f684847d9278b909cf511cb5b0289aShawn Routhier my ($changeid, $category);
380c874925f684847d9278b909cf511cb5b0289aShawn Routhier
380c874925f684847d9278b909cf511cb5b0289aShawn Routhier while (<$fh>) {
380c874925f684847d9278b909cf511cb5b0289aShawn Routhier if (m/---.* released ---/) {
380c874925f684847d9278b909cf511cb5b0289aShawn Routhier next;
380c874925f684847d9278b909cf511cb5b0289aShawn Routhier } elsif (m/^# /) {
380c874925f684847d9278b909cf511cb5b0289aShawn Routhier next;
380c874925f684847d9278b909cf511cb5b0289aShawn Routhier } elsif (m/^\s*(\d+)\.\s+\[(\w+)\]/) {
380c874925f684847d9278b909cf511cb5b0289aShawn Routhier $changeid = $1;
380c874925f684847d9278b909cf511cb5b0289aShawn Routhier $category = $2;
380c874925f684847d9278b909cf511cb5b0289aShawn Routhier # print "*** $1 $2\n";
380c874925f684847d9278b909cf511cb5b0289aShawn Routhier }
380c874925f684847d9278b909cf511cb5b0289aShawn Routhier $changes->{$changeid}->{text} .= $_;
380c874925f684847d9278b909cf511cb5b0289aShawn Routhier $changes->{$changeid}->{category} = $category;
}
return $changes;
}
@ARGV == 2 or die "usage: $0 changes-file-1 changes-file-2\n";
my $c1 = readfile($ARGV[0]);
my $c2 = readfile($ARGV[1]);
foreach my $c (sort {$a <=> $b} keys %$c1) {
if ($c1->{$c}->{category} eq "bug" && !exists($c2->{$c})) {
print $c1->{$c}->{text};
}
}