1

If I go to Work Items-> All Work Item->Edit Query, And look for a specific Issue, I can open that issue and see all links, which are all the changesets for that issue. And if I look at each changeset I can figure out which files have changed.

But this can be confusing if there are a lot of changesets for an issue. What I really want is a consolidated list of all the files that have changed under an issue, with the ability to run a dif between the latest version under that issue compared with the version of that file before the issue.

Is this possible?

1 Answer 1

1

This can't be simply achieved through a work item query or tf command. You may have to use TFS API.

Detail steps should be Getting your Work Item for TFS server, then can all of the Files/Items that were modified and associated with this Work Item, get all of the changeset from a collection of links (Links in a Work Item), list all files in those changsets.

/// <summary>
 /// Get all of the Files/Items that were modified and associated with a Work Item
 /// </summary>
 /// <param name="teamProject">Name of the Team Project</param>
 /// <param name="workItemID">The work item ID</param>
 /// <returns>List of changes</returns>
 public List<FileItem> GetAllFilesModifiedForWorkItem(string teamProject, int workItemID)
 {
  WorkItemCollection workItems = GetWorkItems(teamProject, workItemID);

  if (workItems.Count == 0)
  {
   Console.WriteLine("No Items found for Work Item ID: " + workItemID);

   return null;
  }

  WorkItem item = workItems[0];

  Console.WriteLine("Work Item {0} has {1} Links", workItemID, item.Links.Count);

  if(item.Links.Count == 0)
   return null;

  List<Changeset> lstChangesets = GetChangesets(item.Links);

  Console.WriteLine("Work Item {0} has {1} Changesets", workItemID, lstChangesets.Count);

  if (lstChangesets.Count == 0)
   return null;

  List<FileItem> lstItems = GetItemsForChangeset(lstChangesets);

  Console.WriteLine("Work Item {0} has {1} Items (changes)", workItemID, lstItems.Count);

  if (lstItems.Count == 0)
   return null;

  return lstItems;
 }

The whole code and more detail info please refer this blog: How to get all files modified for a work item in TFS

Moreover, you can also try to use TFS Sidekicks which will also return all the changes for that workitem. Detail ways please refer jagberg's answer in this question: get all changed files for a TFS workitem

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.