views:

176

answers:

4

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.

+2  A: 

svnversion is the command you want. Run svnversion --help for an explanation of the output.

uckelman
This link should help: http://svnbook.red-bean.com/en/1.5/svn.ref.svnversion.re.html
hexium
+5  A: 

(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.

Wolfgang
+1  A: 

You can also use svn info which has the advantage that you don't need to run it somewhere inside the working copy (or provide a path to a working copy) -- you can pass it a URL to the repo and it displays various information about the repository including the latest revision number. svnversion in contrast would show the last revision number of the working copy, but this doesn't need to be identical to the revision of the repository.

Furthermore, svn info shows more details about the repository than svnversion. This might be a pro or a con, depending on your use.

bluebrother
+2  A: 
function Get-SvnRevision($dir)
{
  ([xml](svn info $dir –xml)).info.entry.revision
}

PowerShell, Subversion One Liner

Doug Finke