I would like to add up the number of line changes in an SVN branch so I can tell how far I have gone during a project from another side and estimate the probability of conflict when I merge it with trunk.
The way I can think of is to grab the unified diff and do some grep|wc -l hacks, but the problem is it's hard to separate different file types, for example, front-end source files (.css, .html) and back-end source files(.xml, .java)
To get an overview of your changes, use the svn status command. You may use svn status more than any other Subversion command. If you run svn status at the top of your working copy with no arguments, it detects all file and tree changes you've made.
The svn diff command reveals the differences between your working copy and the copy in the master SVN repository.
Cosidering beginRev as the initial revision of the changeset you want to measure and endRev as the final revision:
svn diff --summarize -rbeginRev:endRev <URLtoBranch>
This will give you the output of files added, deleted and modified.
I you want more detail level you could parse the svn diff output through diffstat
:
svn diff -rbeginRev:endRev <URLtoBranch> | diffstat
This will return an histogram of the changes with information for each file, and a summary of files changed, lines added and deleted.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With