Changed files list in TFS
Hi
I want to be able to produce a distinct list of files (output to csv format) that have been changed ( i.e exclude proj files etc - for example in UI files which have status of 'Edit/Add' and not branch) for a branch/folder by user/date. I've explored Power Tools - tfpt history command and SideKicks. Both tools produce a list of all files and not only changed files.
Any ideas?- Moved byDuke KamstraMSFTThursday, October 29, 2009 12:59 AMMoving to TFS Forum since the question is related to TFS Source Control (From:Visual Studio Database Development Tools (Formerly "Database Edition Forum"))
Answers
- (untested, but should be close to what you want)
Get-TfsItemHistory $/project -r -all -user somebody -version D10/1/2009~ | Select -Expand Changes | Where { $_.changetype.contains("Edit") } | Select-TfsItem | Where { ! $_.path.endswith("proj") } | Sort -Unique Path- Marked As Answer byEd HintzMSFT, ModeratorTuesday, November 03, 2009 12:34 PM
All Replies
- (untested, but should be close to what you want)
Get-TfsItemHistory $/project -r -all -user somebody -version D10/1/2009~ | Select -Expand Changes | Where { $_.changetype.contains("Edit") } | Select-TfsItem | Where { ! $_.path.endswith("proj") } | Sort -Unique Path- Marked As Answer byEd HintzMSFT, ModeratorTuesday, November 03, 2009 12:34 PM
- Hi
Thanks for your response. It does sound as though this may work but which tool does the Get -TfsItemHistory use? I've used Power Tools and the command line is tfpt and does not include ItemHistory. This is the help for tfpt history command:
tfpt history Show the history of an item - Richard used powershell. PowerTools contains some cmdelets for tfs.
Michal Malecki - Hi
Thanks for your response. I did install PowerShell 1.0 for XP SP2. However, I could not get it to work. On searching around I found that I need PowerShell 2.0 which is not available for XP SP2? - To make it work under Powershell 1.0, change the phrase Select -Expand Changes to %{ $_.Changes }. Everything else should work.BTW, Powershell 2.0 for XP can be downloaded here: http://www.microsoft.com/downloads/details.aspx?FamilyId=60cb5b6c-6532-45e0-ab0f-a94ae9ababf5&displaylang=en
- Hi
Sorry to be a pain - It appears that PowerShell 2.0 is only available for XP SP3 and not XP SP2 (certainly I couldn't find a download site). In PowerShell 1.0 cmdlets Get -TfsItemHistory is not available so I can't test or get it to work with the revised phrase - Select -Expand Changes to %{ $_.Changes }. I'd be really grateful for your help. - Yes, apparently SP3 is required for Powershell 2.0. Sounds like a good reason to install SP3 -- the improvements in 2.0 are definitely worth it!If you're launching powershell.exe directly, you'll need to load the Microsoft.TeamFoundation.Powershell snap-in (or do so in your $profile). See help snapin for details. If you are using the dedicated TFS console that's linked in the Power Tools folder of the start menu, the snap-in will be preloaded.
Hi
I've finally managed to install SP3 and also Powershell 2.0 from the link you gave above (interesting that it installs in system32\WindowsPowerShell\v1.0 (I hope it is not version 1.0!). Anyway I've tried to Add Microsoft.TeamFoundation.Powershell as below:
Add-PSSnapin Microsoft.TeamFoundation.PowerShell
However, I'm getting the following mesage:
No snap-ins have been registered for Windows PowerShell version 2.
These are the snapins that are currently installed on my PC:
Name : Microsoft.PowerShell.Diagnostics
PSVersion : 2.0
Description : This Windows PowerShell snap-in contains Windows Eventing and Performance Counter cmdlets.Name : Microsoft.WSMan.Management
PSVersion : 2.0
Description : This Windows PowerShell snap-in contains cmdlets (such as Get-WSManInstance and Set-WSManInstance) that
re used by the Windows PowerShell host to manage WSMan operations.Name : Microsoft.PowerShell.Core
PSVersion : 2.0
Description : This Windows PowerShell snap-in contains cmdlets used to manage components of Windows PowerShell.Name : Microsoft.PowerShell.Utility
PSVersion : 2.0
Description : This Windows PowerShell snap-in contains utility Cmdlets used to manipulate data.Name : Microsoft.PowerShell.Host
PSVersion : 2.0
Description : This Windows PowerShell snap-in contains cmdlets (such as Start-Transcript and Stop-Transcript) that are
provided for use with the Windows PowerShell console host.Name : Microsoft.PowerShell.Management
PSVersion : 2.0
Description : This Windows PowerShell snap-in contains management cmdlets used to manage Windows components.Name : Microsoft.PowerShell.Security
PSVersion : 2.0
Description : This Windows PowerShell snap-in contains cmdlets to manage Windows PowerShell security.
I've tried googling and there does not seem to be much help unfortunately.... Any ideas?
Thanks for your help.- You will probably have to reinstall the Power Tools. I believe they do a check during install to see whether you have powershell, and turn off some features (such as the cmdlets under discussion, and also the Best Practices Analyzer) in that case.
Hi
I've reinstalled and now have added Microsoft.TeamFoundation.PowerShell (though can't seem to get it set up in my profile file).
I've been trying to use the following syntax:
Get-TfsItemHistory $/project -Version “D10/1/09~D11/12/09” -Recurse -IncludeItems | Select-Object -Expand “Changes” | Where-Object { ($_.ChangeType -band ([Microsoft.TeamFoundation.VersionControl.Client.ChangeType]::Delete -bor [Microsoft.TeamFoundation.VersionControl.Client.ChangeType]::Merge -bor [Microsoft.TeamFoundation.VersionControl.Client.ChangeType]::Branch)) -eq 0 } | Select-TfsItem | Group-Object Path | Select-Object Name | Sort-Object
However, the Get-TfsItemHistory [-HistoryItem] is a required parameter (see below for the full syntax). Could you please give me some examples of how I can get a list of only changed files using Get-TfsItemHistory
SYNTAX
Get-TfsItemHistory [-HistoryItem] <QualifiedItemSpec> [-Prompt] [-Recurse] [-Server<TeamFoundationServer>] [-Slotm
ode] [-Stopafter <String>] [-User <String>] [-Version <String>] [-All][<CommonParameters>]
Thanks for your help.- -HistoryItem is a positional parameter. The syntax you posted works for me verbatim.


