git-like line counts in svn using bash

I really like how git tells me how many lines inserted/removed when I commit, and wanted to get something similar from Subversion.  I’m working on a refactoring of an older system, and I wanted to know how my refactorings were effecting the code.  I think I’m going to remove a lot more code than I add, but why wonder when svn has all this info?

Using my horrible bash skills and this post on SVN Line Output Totals, I came up with an inefficient bash program to do what I want:

Example:

 > svn_line_changes -r 264:265
Scanning -r 264:265
Removed: 287
Added: 141
Difference: -146

2 Comments »

  1. Daniel Westermann-Clark said,

    January 18, 2010 @ 8:09 pm

    There’s a program called diffstat that takes a diff and outputs a histogram like git:

    http://invisible-island.net/diffstat/

    If I remember to use it, it’s usually something like:

    svn diff -c 265 | diffstat

  2. Random Links #117 | YASDW - yet another software developer weblog said,

    January 24, 2010 @ 5:07 pm

    [...] git-like line counts in svn using bash Nice subversion script [...]

RSS feed for comments on this post · TrackBack URI

Leave a Comment