Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Count number of SVN commits within a repository directory

Tags:

php

svn

I need to find the number of commits for a directory within a repository. I will be dealing with the result within PHP so would probably need to utilise exec(). It will be running on Linux.

I have a slightly quirky repository where the directory structure looks a little like:

  • /trunk/section1
  • /trunk/section2
  • /trunk/section3 (and so on)

I'm going to use the result as part of the version number for each section. As it stands I use the latest revision but ideally would like to have it numbered sequentially instead of 84 -> 120 -> 400 etc.

I plan on counting the commits and using '3' instead of '400', using the above example.

like image 360
Liam Avatar asked Oct 17 '25 18:10

Liam


1 Answers

If you really like to count the number of commits just use the following:

svn log -q --stop-on-copy URL/trunk | grep "^r" | wc -l

will printout the number of commits.

like image 78
khmarbaise Avatar answered Oct 20 '25 06:10

khmarbaise



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!