Created
December 16, 2014 12:23
-
-
Save constructor-igor/b3bd862bf6e582f0b467 to your computer and use it in GitHub Desktop.
How to get changes files from SVN between two revisions with PowerShell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# from http://hmemcpy.com/2014/12/how-to-get-changes-files-from-svn-between-two-revisions-with-powershell/ | |
# | |
function Export-SvnDiff($repo, $fromRevision, $toRevision, $outputDirectory) | |
{ | |
$xpath = "/diff/paths/path[@kind='file' and (@item='added' or @item='modified')]" | |
[xml]$output = & svn diff -r $("{0}:{1}" -f $fromRevision, $toRevision) $repo --summarize --xml | |
$output | Select-Xml -XPath $xpath | % { $_.node."#text" } | % { | |
$targetFile = Resolve-FullPath (Join-Path $outputDirectory ($_ -replace $repo)) | |
$targetDir = $targetFile | Split-Path | |
New-Item -Force -ItemType directory -Path $targetDir | Out-Null | |
& svn export -r $toRevision -q --force $_ $targetFile | |
Write-Host ("$_ -> $targetFile") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment