Advertisement
Guest User

Untitled

a guest
Jul 27th, 2016
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. # Clear Output Pane
  2. clear
  3.  
  4. # Enforce coding rules
  5. Set-StrictMode -version 2.0
  6.  
  7. # Loads Windows PowerShell snap-in if not already loaded
  8. if ( (Get-PSSnapin -Name Microsoft.TeamFoundation.PowerShell -ErrorAction SilentlyContinue) -eq $null )
  9. {
  10. Add-PSSnapin Microsoft.TeamFoundation.PowerShell
  11. }
  12.  
  13. # Variables - CHECK EACH TIME
  14. [string] $tfsCollectionPath = "http://tfs:8080/tfs/"
  15. [string] $locationToSearch = "$/OurCode"
  16. [string] $outputFile = "c:ChangesToTFS.txt"
  17. [string] $changesets = "C629220~C629339"
  18. [string] $changesetstofilter = "C629220,C629339"
  19. [bool] $openOutputFile = $true # Accepts $false or $true
  20.  
  21. [Microsoft.TeamFoundation.Client.TfsTeamProjectCollection] $tfs = get-tfsserver $tfsCollectionPath
  22.  
  23. # Add informational header to file manifest
  24. [string] $outputHeader =
  25. "TFS Collection: " + $tfsCollectionPath + "`r`n" +
  26. "Source Location: " + $locationToSearch + "`r`n" +
  27. "ChangeSets: " + $changesets + "`r`n" +
  28. "Created: " + (Get-Date).ToString() + "`r`n" +
  29. "======================================================================"
  30.  
  31. $outputHeader | Out-File $outputFile
  32.  
  33. Get-TfsItemHistory $locationToSearch -Server $tfs -Version $changesets `
  34. -Recurse -IncludeItems |
  35.  
  36. Select-Object |
  37. Where-Object {
  38. $_.ChangesetId -like '*629220*' -or
  39. $_.ChangesetId -like '*629339*'
  40. } |
  41.  
  42. Select-Object -Expand "Changes" |
  43. Where-Object { $_.ChangeType -notlike '*Delete*'} |
  44. Where-Object { $_.ChangeType -notlike '*Rename*'} |
  45.  
  46. Select-Object -Expand "Item" |
  47. Where-Object { $_.ContentLength -gt 0} |
  48.  
  49. Select -Unique ServerItem | Sort ServerItem |
  50. Format-Table -Property * -AutoSize | Out-String -Width 4096 |
  51. Out-File $outputFile -append
  52.  
  53. Write-Host `n`r**** Script complete and file written ****
  54.  
  55. If ($openOutputFile) { Invoke-Item $outputFile }
  56.  
  57. Select-Object |
  58. Where-Object {
  59. $_.ChangesetId -like '*629220*' -or
  60. .... Repeat for each changeset
  61. $_.ChangesetId -like '*629339*'
  62. } |
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement