In the interests of peace and harmony (;-), I'd like to submit the attached perl script, which lists the status of cvs-controlled files. In particular, it's very useful for determining which files have been modified but not committed, like: i386/linux/linux_file.c Locally Modified kern/imgact_elf.c Locally Modified CVS is severely lacking in many areas (it is all we have, though), and one thing it is missing is an easy way of showing concise file status. As a result, it's easy to forget about locally-modified files. This perl script will list all files, in the current directory and below, that do not have a status of "Up-to-date", such as those which have been locally modified or which need updating. To use this script, just cd to some directory that contains cvs- controlled files and run the script. A list of non-up-to-date files in the current directory and below will be listed. Note that this script isn't particularly fast, as it has to execute a cvs command in each and every directory (due to cvs deficiencies). As examples, the script takes around 3 minutes to run under /usr/src/sys, and around 30 minutes for /usr/src (checked out via "cvs checkout src"). [ My (local, mirrored via cvsup) repository is accessed via pserver over 128K ISDN, and so there's a good chance that many people will see better performance. ] -- Darryl Okahata [EMAIL PROTECTED] DISCLAIMER: this message is the author's personal opinion and does not constitute the support, opinion, or policy of Hewlett-Packard, or of the little green men that have been following him all day.
#! /usr/bin/perl ############################################################################### # # File: cvsinfo # RCS: $Header: $ # Description: # Author: Darryl Okahata # Created: Wed Jul 15 14:52:01 1998 # Modified: Thu Sep 23 11:35:35 1999 (Darryl Okahata) [EMAIL PROTECTED] # Language: CPerl # Package: N/A # # (C) Copyright 1998, Hewlett-Packard, all rights reserved. # ############################################################################### $listfile = ".changed-files"; ############################################################################### require 'getopts.pl'; &Getopts('ac'); $all_status = 1 if ($opt_a); $update_changed_file = 1 if ($opt_c); require "pwd.pl"; &initpwd; $top_dir = $ENV{'PWD'}; ############################################################################### open(DIRS, "find . -type d | sort |") || die "$!"; while ($dir = <DIRS>) { chdir($top_dir); # make sure we're in a known location chop($dir); $dir =~ s|^\./||; $dir = '.' if ($dir eq ''); # print "$dir\n"; next if (!-d "$dir/CVS"); &process_dir($dir); } close(DIRS); if ($update_changed_file) { unlink($listfile); open(OUT, ">$listfile") || die "$listfile: $!"; if ($#update_files >= 0) { foreach $file (sort @update_files) { print OUT "$file\n"; } } close(OUT); } exit 0; ############################################################################### sub process_dir { local($dir) = @_; local($file, $status, $cmd); # print "$dir\n"; chdir($dir); $cmd = "cvs status -l"; open(IN, "$cmd 2>&1 |") || die "$!"; while (<IN>) { if (/^File:\s+([^\s]+)\s+Status:\s+(.+)$/i){ $file = $1; $status = $2; if ($all_status || $status ne 'Up-to-date') { if ($status eq 'Needs Patch') { $status = 'Needs Updating'; } printf("%-50s %s\n", ($dir eq '.') ? $file : "$dir/$file", $status); if ($status =~ /Locally Modified/) { push(@update_files, $file); } } } elsif (/\[status\s+aborted\]/) { die "$_\n"; } # print; } close(IN); }