This script summarises a cvs stat for you - no more doing a cvs up just to find out what's changed (and screwing your merges at the same time).

Just be in the root of the directory tree you care about, and run the script, just like you would cvs stat (easier if it's in your path, but not essential).

Advanced niceness includes ansi colorisation and convenient alignment.

> 80 columns recommended :)

Term::ANSIColor required

#!/usr/bin/perl =head1 NAME cvs_stat - get summarised cvs status ignoring files that are up to dat +e =head1 CAVEATS There is probably a useful cpan cvs module this should use. =cut use strict; use Term::ANSIColor qw/colored/; open FH, 'cvs stat 2>&1 |'; my $dir; while (<FH>) { chomp $_; if (/^\? (.*)$/) { printf( '%27s: %s'."\n", '?', $1); next; } if (/^cvs (?:server|status): Examining (.*)$/) { $dir = $1; } if (/^File: (.*[^ ])\s+Status: (.*)$/) { my $file = $1; my $status = $2; $status eq 'Up-to-date' and next; my $padding = ' ' x (27 - length $status); my $file = ": $dir/$file"; if ( $status eq 'Locally Modified' ) { $status = colored($status, 'bold blue'); } elsif ( $status eq 'Needs Merge' ) { $status = colored($status, 'bold red'); } print $padding, $status, $file, "\n";; next; } }

Replies are listed 'Best First'.
Re: cvs_stat
by hossman (Prior) on Jan 11, 2005 at 19:22 UTC

    no more doing a cvs up just to find out what's changed (and screwing your merges at the same time).

    cvs -n update

      Yeah fair point - but mine has pretty colours...
Re: cvs_stat
by Tanktalus (Canon) on Jan 22, 2005 at 22:07 UTC

    I'm not sure about your cvs ... but it doesn't quite work here. Here's a patch:

    --- cvs_stat.old 2005-01-22 14:58:27.000000000 -0700 +++ cvs_stat 2005-01-22 15:03:21.000000000 -0700 @@ -23,7 +23,7 @@ printf( '%27s: %s'."\n", '?', $1); next; } - if (/^cvs server: Examining (.*)$/) { + if (/^cvs (?:server|status): Examining (.*)$/) { $dir = $1; } if (/^File: (.*[^ ])\s+Status: (.*)$/) {
    Here, cvs stat says "cvs status: Examining", not "cvs server: Examining".

    Next steps in cleaning this up are: eliminating the annoying "./" prefix for files in the current directory (debatable - maybe that's just me), and adding the dir prefix for the unknown files.

      I'll apply that - must be a different version of cvs.

      I don't get a ./ prefix for the current directory, and I _do_ get the dir prefix for new and missing files (that's why the script keeps track of the dir seperately).

      Maybe your cvs output is quite different - what version do you have?

        Here's the version:

        $ cvs -v Concurrent Versions System (CVS) 1.11.2 (client/server) Copyright (c) 1989-2001 Brian Berliner, david d `zoo' zuhn, Jeff Polk, and other authors CVS may be copied only under the terms of the GNU General Public Licen +se, a copy of which can be found with the CVS distribution kit. Specify the --help option for further information about CVS

        I guess we can't always count on cvs being cvs ;-)