Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
While working on continuous integration, I needed the name of the most recently created tag in a Subversion repository. So I wrote a little PowerShell script that would find the name for me by looking in the Subversion log.
[string]$Url = "svn://my.repo.url",
[string]$Username = "krouwhorst",
[string]$Password = "secret"
Function Get-SubversionLog {
([xml](svn log $Url --xml --verbose --username $Username --password $Password)).log.logentry | ForEach {
$item = $_
$_.paths.path | ForEach {
$path = $_
$item | Select -Property @(
@{ Name='Author'; Expression={$_.Author}},
@{ Name='Revision'; Expression={([int]$_.Revision)}},
@{ Name='Message'; Expression={$_.msg}},
@{ Name='Date'; Expression={Get-Date $_.Date}},
@{ Name='Action'; Expression={$path.action}},
@{ Name='Kind'; Expression={$path.kind}},
@{ Name='Path'; Expression={$path.InnerText}})
Get-SubversionLog |
Where { $_.Action -eq 'A' -and $_.Kind -eq 'dir' -and $_.Path -like '*/tags/*' } |
Select Author, Revision, Date, Path |
Sort Date -Descending |
Select -First 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.