Powershell – Getting SVN repository rev number

batch-filepowershellsvn

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.

Best Solution

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

PowerShell, Subversion One Liner