#!/usr/bin/perl # (c) 2003 Alex Fritze # # cvslstat version 1.0 use POSIX; sub usage { print <) { if (/^\/(.*)\/(.*)\/(.+)\/(.*)\/(.*)/) { my $filename = $1; my $timestamp = $3; my $mtime = asctime(gmtime((stat($dir . "/" . $filename))[9])); chomp $mtime; if ($timestamp =~ /(.+)\+(.+)/) { if ($edited || $unedited) { $conflict{$filename} = $1; if (timestamp_eq($mtime,$2)) { if ($unedited) { $unresolved{$filename} = 1; } else { # we don't want files that have been edited: delete($conflict{$filename}); } } elsif (!$edited) { # we only want files that have not been resolved: delete($conflict{$filename}); } } } elsif ($modifieds && (!timestamp_eq($mtime,$timestamp))) { $modified{$filename} = $timestamp; } } elsif (/^D\/([^\/]*)\//) { $subdir{$1} = 1; } } close(ENTRIES); open(LOG, $dir . "/CVS/Entries.Log"); # fail silently; file is optional while () { if (/^A D\/([^\/]*)\//) { $subdir{$1} = 1; } elsif (/^R D\/([^\/]*)\//) { delete($subdir{$1}); } elsif (/^[AR]/) { die "unknown entry in Entries.Log!" } } close(LOG); if ($directories) { print "* $dir:\n"; } while (($file, $description) = each (%conflict)) { print "$dir/$file"; if (!$quiet) { print " had a merge conflict"; if ($verbose) { print " (cvs timestamp = '$description'"; if ($veryverbose) { my $mtime = asctime(gmtime((stat($dir . "/" . $file))[9])); chomp $mtime; print "!='$mtime'"; } print ")"; } if ($unresolved{$file}) { print " and has not been edited"; } else { print " but has since been editied"; } } print "\n"; } while (($file, $description) = each (%modified)) { print "$dir/$file"; if (!$quiet) { print " is locally modified"; if ($verbose) { print " (cvs timestamp = '$description'"; if ($veryverbose) { my $mtime = asctime(gmtime((stat($dir . "/" . $file))[9])); chomp $mtime; print "!='$mtime'"; } print ")"; } } print "\n"; } # now process subdirs if requested: if (!$local) { foreach $key (keys %subdir) { process_dir($dir . "/" . $key); } } } # ---------------------------------------------------------------------- # main # parse options: while ($_ = $ARGV[0], /^-/) { shift; if (/^--help$/) { usage; } elsif (/^-l$/) { $local = 1; } elsif (/^-q$/) { $quiet = 1; } elsif (/^-c$/) { $unedited = 1; $edited = 1; } elsif (/^-u$/) { $unedited = 1; } elsif (/^-e$/) { $edited = 1; } elsif (/^-m$/) { $modifieds = 1; } elsif (/^-v$/) { $verbose = 1; } elsif (/^-vv$/) { $verbose = 1; $veryverbose = 1; } elsif (/^-d$/) { $directories = 1; } else { usage; } } if (!$edited && !$unedited && !$modifieds) { $edited = 1; $unedited = 1; $modifieds = 1; } if ($ARGV[0]) { usage; } # walk the CVS directories: process_dir(".");