[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Quick (hopefully) CVS question.....



Quoting Andrew Basterfield (bob_(_at_)_cemetery_(_dot_)_homeunix_(_dot_)_org):
> On Wed, 28 May 2003 14:46:40 +0100,
> Alan Smith <asmith_(_at_)_intuition_(_dot_)_com> wrote:
> > Folks,
> > 
> > I update my /usr/src directory using CVS and everything works great. I
> > was just wondering if there is a switch for CVS that will give a
> > summary at the end of the update, as in "10 files updated,5 files
> > deleted,20 new files.....". I have had a look through some CVS docs
> > but can't find anything related.
> 
> cvs up -dP | tee /var/log/last-cvs.log
> 
> grep ^U /var/log/last-cvs-log | wc -l
> grep ^M /var/log/last-cvs-log | wc -l
> grep ^P /var/log/last-cvs-log | wc -l

(paste works in /bin/sh, but not in csh - line continuation issues)

This isn't pretty, but it's a bit more flexible and powerful than
greps.

cvs -q update -dAP \
| awk 'BEGIN {U=0;C=0;M=0;P=0;Unk=0; Gone=0; other=0; total=0}
    // {total++}
    $1~/^C/ {C++; next}
    $1~/^M/ {M++; next}
    $1~/^P/ {P++; next}
    $1~/^U/ {U++; next}
    /is not.*pertinent/ {Gone++; next}
    $1~/^\?/ {Unk++; next}
    {other++; print "Dunno:", $0; next}
    END {printf "C=%d\nM=%d\nP=%d\nU=%d\n", C, M, P, U;
         printf "Unknown files=%d\nOther=%d\nTotal=%d\n", Unk, Other, total;
         printf "Deleted=%d\n", Gone
	}'




Work that END line for prettier output
Oh, and I'm sure there are other output lines from CVS, they will appear
on screen with "Dunno:".



Visit your host, monkey.org