Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting SVN repository rev number

Is there some svn or svnadmin command that will display the revision of a local repo? I'd like to be able to have a Windows batch or PowerShell script that would let me zip up the repo and name it with the rev to email.

The best I can figure out is just to find the highest file in [reporoot]\db\revs\0, but it seems kind of clunky and I don't know if it is reliable.

like image 387
Nick T Avatar asked Oct 26 '09 21:10

Nick T


2 Answers

function Get-SvnRevision($dir)
{
  ([xml](svn info $dir --xml)).info.entry.revision
}

PowerShell, Subversion One Liner

like image 74
Doug Finke Avatar answered Sep 30 '22 15:09

Doug Finke


(Edit) svnversion is not so good because it relates to the working copy, not to the repository.

svn info also relates to the working copy.

=> svnlook youngest REPOS_PATH should do it. See also svn redbook.

like image 38
Wolfgang Avatar answered Sep 30 '22 16:09

Wolfgang