info-cvs
[Top][All Lists]
Advanced

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

Re: Number of lines of code changed between tags


From: Matthew Riechers
Subject: Re: Number of lines of code changed between tags
Date: Fri, 27 Apr 2001 07:33:24 -0400

Here's an awk script that shows the lines for each file in a diff, with totals 
at the end.
It looks like what you get from a cvs log. Just change "Index" to "diff" for a 
non-cvs diff.

use like:

cvs diff -r tag1 -r tag2 |awk -f diffloc.awk

It's ugly but it works :)

Matt

----------------------- snip ---------------------------
#
# count lines in/out (like "cvs log") for an arbitrary diff
# This script can handle recursive diffs
# NOTE: The diff must be in the default format; context and unidiff is not 
supported
#

/^>/ {i++}
/^</ {j++}

/^Index/ {
        if (saved) {
                printf ("%s\t+%d -%d lines\n", saved, i, j)
                l_in += i
                l_out += j
                i = j = 0
        }
        saved = $0
}

END {printf ("\t\ttotal: +%d -%d lines\n", l_in, l_out)}
----------------------- snip ---------------------------

Eric Siegerman wrote:
> 
> On Thu, Apr 26, 2001 at 03:48:01PM -0700, Keith Beattie wrote:
> > How can I find the total number of lines changed (for text files only)
> > between two static tags for an entire module or subtree of the repository?
> 
> cvs diff -r tag1 -r tag2 | ... | wc
> 
> The ... is whatever intelligence you want to employ to filter out
> noise to get a more accurate count.
> 
> --
> 
> |  | /\
> |-_|/  >   Eric Siegerman, Toronto, Ont.        address@hidden
> |  |  /
> With sufficient thrust, pigs fly just fine. However, this is not
> necessarily a good idea.
>         - RFC 1925 (quoting an unnamed source)
> 
> _______________________________________________
> Info-cvs mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/info-cvs



reply via email to

[Prev in Thread] Current Thread [Next in Thread]