Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Clear Output Pane
- clear
- # Enforce coding rules
- Set-StrictMode -version 2.0
- # Loads Windows PowerShell snap-in if not already loaded
- if ( (Get-PSSnapin -Name Microsoft.TeamFoundation.PowerShell -ErrorAction SilentlyContinue) -eq $null )
- {
- Add-PSSnapin Microsoft.TeamFoundation.PowerShell
- }
- # Variables - CHECK EACH TIME
- [string] $tfsCollectionPath = "http://tfs:8080/tfs/"
- [string] $locationToSearch = "$/OurCode"
- [string] $outputFile = "c:ChangesToTFS.txt"
- [string] $changesets = "C629220~C629339"
- [string] $changesetstofilter = "C629220,C629339"
- [bool] $openOutputFile = $true # Accepts $false or $true
- [Microsoft.TeamFoundation.Client.TfsTeamProjectCollection] $tfs = get-tfsserver $tfsCollectionPath
- # Add informational header to file manifest
- [string] $outputHeader =
- "TFS Collection: " + $tfsCollectionPath + "`r`n" +
- "Source Location: " + $locationToSearch + "`r`n" +
- "ChangeSets: " + $changesets + "`r`n" +
- "Created: " + (Get-Date).ToString() + "`r`n" +
- "======================================================================"
- $outputHeader | Out-File $outputFile
- Get-TfsItemHistory $locationToSearch -Server $tfs -Version $changesets `
- -Recurse -IncludeItems |
- Select-Object |
- Where-Object {
- $_.ChangesetId -like '*629220*' -or
- $_.ChangesetId -like '*629339*'
- } |
- Select-Object -Expand "Changes" |
- Where-Object { $_.ChangeType -notlike '*Delete*'} |
- Where-Object { $_.ChangeType -notlike '*Rename*'} |
- Select-Object -Expand "Item" |
- Where-Object { $_.ContentLength -gt 0} |
- Select -Unique ServerItem | Sort ServerItem |
- Format-Table -Property * -AutoSize | Out-String -Width 4096 |
- Out-File $outputFile -append
- Write-Host `n`r**** Script complete and file written ****
- If ($openOutputFile) { Invoke-Item $outputFile }
- Select-Object |
- Where-Object {
- $_.ChangesetId -like '*629220*' -or
- .... Repeat for each changeset
- $_.ChangesetId -like '*629339*'
- } |
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement