Skip to content

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

One Comment

  1. Daniel Westermann-Clark wrote:

    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

    Monday, January 18, 2010 at 8:09 pm | Permalink

One Trackback/Pingback

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