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;
}
}
In reply to cvs_stat
by aufflick
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.