#!/usr/bin/perl use warnings; use strict; use File::Spec::Functions qw(catfile); my $Base = "/Users/brian/Dev"; @ARGV = catfile( $Base, 'bad_cvs_root.txt' ); my %Seen = (); while( <> ) { chomp; my $top_level = (split m|/|, $_)[0]; # ugh, not portable next if exists $Seen{ $top_level }; $Seen{ $top_level } ++; my $dir = catfile( $Base, $top_level ); print "checking $dir ... "; chdir $dir or do { warn "Could not chdir $dir: $!"; next }; my @output = `cvs update 2>&1`; my $message = parse_cvs( @output ); print $message ? "\n$message" : "up-to-date\n"; } sub parse_cvs { my %cvs_state; my %message = ( C => 'These files have conflicts', M => 'These files have not been checked in', U => 'These files were missing and have been updated', A => 'These files were added but not checked in', '?' => q|I don't know about these files|, ); my @cvs_states = keys %message; foreach my $state ( @cvs_states ) { my $regex = qr/^\Q$state /; $cvs_state{$state} = [ map { my $x = $_; $x =~ s/$regex//; $x } grep /$regex/, @_ ]; } local $" = "\t"; my $rule = "-" x 50; my $string = ''; foreach my $key ( sort keys %cvs_state ) { my $list = $cvs_state{$key}; next unless @$list; $string .= sprintf "\t$message{$key}\n\t$rule\n\t@$list\n\n"; } return $string; }