use Modern::Perl;
use warnings FATAL => 'syntax';
use File::Basename qw(basename);
use XML::Simple;
die "usage: $0 repo transaction\n" if @ARGV != 2;
my $opt = "-t";
my ($repos, $txn) = @ARGV;
my @info = `svnlook info $opt $txn "$repos"`;
exit 0 if ($info[3] =~ /\A!/);
my @lines = `svnlook changed $opt $txn "$repos"`;
my @projects = grep { /\AU/ }
grep { /[.]csproj\z/ }
map { chomp; $_ } @lines;
my @filelist = `svnlook tree $opt $txn "$repos" --full-paths`;
my %present;
foreach (@filelist) {
chomp;
$present{$_} = 1;
}
foreach (@projects) {
m"\AU.\s\s([\w/.]+/)([\w]+\.csproj)\z" or die "bad line $_";
my ($path, $proj) = ($1, $2);
my $projfile = `svnlook cat $opt $txn "$repos" $path/$proj`;
my $xml = XMLin($projfile);
my @includes = @{$xml->{ItemGroup}->[1]->{Compile}};
my @filenames = map {$_->{Include}} @includes;
foreach (@filenames) {
next if /\A[.][.]/;
my $file = $path . $_;
$file =~ tr|\\|/|;
if (!defined $present{$file}) {
die "The file $file is included in the project $path\\$proj, but is not present in the tree, did you forget to commit it?";
}
}
}
source
share