English 中文(简体)
A way to find out all affected files of a workItem or group of chgsets in TFS 2008?
原标题:

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.

最佳回答

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.

问题回答

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





相关问题
Why not use TFS as a build / CI solution?

Currently our build solution is set up using TFS + MS Build scripts. TFS is also being used as a CI server. I ve seen several posts on this site telling people about other CI solutions. Are there ...

Get files from TFS under Linux [closed]

is there a free (command line) tool for linux which with I can get all files from a TFS-Repository (no Check in / Check out required - only get actual version)?

upgrading tfs 2008 sp1 to use sql server 2008

I have an instance of tfs 2008 supported by sql server 2005. I want to change the sql server machine by doing a restore based move. I also want to change the version of sql server to 2008. I know ...

Using Git in a TFS shop

Using Git at home has spoiled me - I now find using TFS at work to be a bit of a drag and want to explore the possibility of using Git locally and syncing somehow with TFS. I figure there are a few ...

TFSReg in 2010 Beta 2?

does anybody know what is the equivalent of the TFSReg.exe command-line tool in 2010 Beta 2? I cannot find it anywhere, I searched the entire Program Files tree. Was it renamed? Moved? Replaced by ...

热门标签