Created
November 23, 2013 19:12
-
-
Save jen20/7618685 to your computer and use it in GitHub Desktop.
Powershell function to remove unversioned items from a Subversion working copy
This file contains hidden or 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
| Function Clean-SvnWorkingCopy { | |
| Param( | |
| [Parameter(Mandatory=$true, Position=0, HelpMessage="Path to the repository to clean")] | |
| [string]$repositoryPath | |
| ) | |
| Process { | |
| Push-Location $repositoryPath | |
| [xml]$svnChangelist = Exec { svn status --xml } | |
| $entries = $svnChangelist.GetElementsByTagName("entry") | |
| foreach ($change in $entries) { | |
| if ($change.GetElementsByTagName("wc-status")[0].GetAttribute("item") -eq "unversioned") { | |
| $toRemove = $change.GetAttribute("path") | |
| Remove-Item -Force $toRemove | |
| } | |
| } | |
| Pop-Location | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Probably wants updated to revert other files that are versioned