Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SVN Getting The Count Of Revisions Of A Repository

I am curently working on a Qt c++ project that is basically printing all the commit log messages between a specific SVN Repository's 2 specific revision's (User enters the repo and the revisions).

I need to get the count of revisions in a repo URL.

I want to do this on Windows 10 so I guess a batch command could be pretty useful.

I am using Visual SVN Server and Tortoise SVN.

(My Qt version is 5.11.1 if it would be necessary)

I have a batch script that does print all the logs between 2 specific revisions to a .txt file.

It is like this:

@ECHO OFF

REM This Script Takes all the logs between a given repository's 2 specific revision.

REM Below, we store the first parameter which is the URL of the Repository that is wanted.
SET urlOfRepository=%1

REM Below, we store the second parameter which is the first revision that is wanted.
SET firstRevision=%2

REM Below, we store the third parameter which is the second revision that is wanted.
SET secondRevision=%3

REM Below is the command for getting all the log messages between the first and the second revision that is wanted in the wanted repository and printing to a .txt file.
svn log -r %firstRevision%:%secondRevision% --limit %secondRevision% %urlOfRepository% > svnLog.txt

EXIT /B 0

I would be glad if someone can help me.

I can clarify the question more if it is needed so please do not hesitate to contact me via comments.

Thanks in advance.

Thanks to Kostix the answer is:

svn info -r HEAD --show-item revision %URL%

And I have written a script to solve my problem. Here it is:

@ECHO OFF

REM This Script writes the revision count of a specific SVN repository

REM Below, we store the first parameter which is the URL of the Repository that is wanted.
SET urlOfRepository=%1

REM Below, is the command that returns the count of revisions in the specifically given SVN repository and writes to a .txt file
svn info -r HEAD --show-item revision %urlOfRepository% > svnCountOfRepoRevisions.txt

EXIT /B 0
like image 815
BUY Avatar asked Jan 21 '26 23:01

BUY


1 Answers

There's no need to do it that complicated—a mere

svn log -r HEAD:1 %URL%

should work.

The special HEAD revision is automatically the last one in the repository, and the revision 1 is the first one (obviously).

Subversion is smart enough to skip revisions in which the URL does not exist, so, say, if it was added in revision 42, svn log won't complain there is no URL in the revision range [41…1].


You can obtain more info by running

svn help log

in your console window.

like image 60
kostix Avatar answered Jan 23 '26 14:01

kostix



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!