([xml](svn info C:\Code --xml)).info.entry.revision
Returns the revision number of a subversion working copy.
Wrap it in a function
function Get-SvnRevision($dir)
{
([xml](svn info $dir --xml)).info.entry.revision
}
Get-SvnRevision C:\Code
This comes in handy when building scripts to interact with Subversion.
Automating an svn update, compiling the code and producing executables with the svn revision number burned in for QA and Customer tracking.





{ 3 comments… read them below or add one }
and of course another one of your great one liners
$log = [xml] (svn log http://svn.smartorg.com/svn/dev/SpikeTests –xml); $log.log.logentry | ft author, msg -auto | more
Hi Doug,
The function version has only one ‘-’ before the xml.
I could not get the PowerShell function version to work until I modified -xml to –xml. I’m a PowerShell noob. Did I miss somthing?
Thanks.
Thanks for the comment Richard. You are correct.
The HTML had the –xml. I wrapped it in a pre tag and now it shows up in the post.
Thanks for catching that.
Doug