Robert Downey
News
About Me
My Thoughts
Resume
Code
Contact Me

Team Foundation Server Recursive History Utility

by RMD 24. August 2006 20:59

I've recently migrated to using Microsoft Team Foundation Server for nearly all my source control, work item tracking, and build management. So far I absolutely love it. For the most part, I'll never look back at VSS again... but every once in a while I encounter something that TFS is missing that VSS did easily.

Once such case was a few days ago when I had to figure out exactly what files have changed in a source tree since my last production build. I do this to manually check the scope of changes in a project. It's essentially a sanity check. In VSS this was trivial; just open up VSS, do a search, and refine by label and/or date and time. Done.

In Team Foundation Explorer, I found no way of doing this. I could easily get a list of changesets since a label, but that really doesn't help me unless I want to go through each and every changeset and write down what files changed in that change set. (In other words, double click on every changeset to open the files window.) Considering the size of my project, this would take hours. Honestly, I was shocked there wasn't a way to do this.

After a little research I decided the only way to do this was to write a quick utility. Luckily, programming against TFS is fairly easy. Despite the relative lack of documentation for the API, it's pretty easy to figure out. After about 15 minutes I had a working app, and after about an hour I had an application that was good enough for anybody to use. It's written in C# 2.0 and leverages the Microsoft.TeamFoundation.* libraries.

I call it TFRecursiveHistory. You give it a server, a project path, a label, and optionally a list of extensions, and it will output a list of TFS source control file paths for files that have changed since that label was applied. Works like a charm. Here is an example:

TFRecursiveHistory.exe /s:MyServer /p:"$/My Project/Main" /l:1.1.0.0 /ext:.cs,.cpp,.aspx

That would give you a list of all the cs, cpp, and aspx files that have changed since the label 1.1.0.0 was applied to the source tree "$/My Project/Main".

You can download it from my Code section, along with the source and VS.NET 2005 project files.

Update
Buck Hodges, a developer lead for Team Build at Microsoft, posted a link to my utility and a warning regarding its accuracy. Essentially, because a TFS label is not a point in time it's possible that the file list won't be completely accurate if the label has changed. So use at your own risk.

Tags:

Software Development