caarlos0
caarlos0

Reputation: 20633

Get Total of files changed, additions and deletions of a SVN commit

I tried to get the total of files changed, total of lines added and removed in a specific SVN commit, without success.

I tried something like:

svn diff -r 12983:12984 > patch.diff 
cat patch.diff | grep $'+'
cat patch.diff | grep $'-'

But it doesn't look right. Also, I can't figure out how many files I have changed.

How can I do that?


I actually get it working with the following:

svn diff -r REV1:REV2 > patch.diff 
cat patch.diff | grep $'^+ ' | wc -l # additions
cat patch.diff | grep $'^- ' | wc -l # deletions
svn diff --summarize -r REV1:REV2 | wc -l # total files changed

Thanks everyone.

Upvotes: 1

Views: 469

Answers (2)

San7988
San7988

Reputation: 106

You may use something like
svn diff --summarize -r REV1:REV2 <PATH/URL> | wc -l

Hope this helps.

Regards

Upvotes: 1

gbjbaanb
gbjbaanb

Reputation: 52659

Looks about right to me, but I'd grep for '+ ' not just '+' as you will get lines like:

+++ xyz.txt <revision n>

at the beginning of every file in your unified diff.

You might like to read the format of patch files.

Upvotes: 1

Related Questions