Question

I'm trying to figure out a way to find out which files were affected by a work item in TFS 2008.

I realize that this is a duplication of a question already asked by someone else here - View a list of all files changed as part of a Workitem in TFS but it went unanswered and I've been, off and on, looking for this for a while.

I understand can view the links tab of the work item and then view each changeset to see the files that have been changed. But, the work item very likely will end up with many changesets linked to it, and I would like to review the files modified as part of the work item, but I feel like the likelihood of missing a file or two is very high if I have to rely on looking at each of the 100+ changesets individually.

Does anyone know of a way to accomplish this? Thanks in advance for any help or guidance.

Was it helpful?

Solution

Sounds like a job for Powershell...

function Get-TfsItem([int] $workItemNumber)
{
    Get-TfsServer njtfs -all |
        foreach { $_.wit.GetWorkItem($workItemNumber) } |
        foreach { $_.Links } |
        foreach { ([regex]'vstfs:///VersionControl/Changeset/(\d+)').matches($_.LinkedArtifactUri) } |
        foreach { $_.groups[1].value } |
        Get-TfsChangeset | 
        Select-TfsItem |
        Sort Path -Unique 
}

The first several lines are kind of ugly. We have to hit the webservice API directly since the TFS cmdlets don't cover the bug tracking system. And the objects we get back require some regular expression love before they'll do what we need. Piping to "foreach" over & over is an unfortunate Powershell idiom that arises when you mate an unfriendly API to a lame projection operator. (I use my own replacement, personally, but you can't rely on that.)

The last 3 lines should be self explanatory if my TFS Power Cmdlets are installed & doing their job.

OTHER TIPS

I just found Scrum Power Tools plugin for VS 2010 that does this with a button click in VSS, installed and it worked. http://visualstudiogallery.msdn.microsoft.com/3f261226-530e-4e9c-b7d7-451c2f77f262

I am just trying to make the powershell version 2010 work. http://msdn.microsoft.com/en-us/vstudio/bb980963

First problem is that the pwoer shell option is not installed by default, use custom install and select that option. When completed there is a powershell prompt in the TFS powertools 2010 menu, the commands only work in there.

The get server I had to replace njtfs with the url http://tfsserver:8080/tfs and remove -all. The script still fails.

Ultimately I need a detail report that lists: source 'work item' 'change set'

For example:
xyz.cs 'work item 1' 'C397'
xyz.cs 'work item 2' 'C399'

Eventually I have to then work out that work item 1 is dependant on work item 2. I also have to track back to work item 1 to check the status.

Can someone assist with a 2010 version script? I have never written PS before.

I needed the exact same thing and I wrote a TFS utility for myself, using TFS API. It allows you to see all changes a work item triggered over time, and some things more. I've put it on codeplex. You can get it from:
tfshelper.codeplex.com

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top