The Team Foundation Power Toy and Undo Unchanged


Buck Hodges' Team Foundation Power Toy has some functionality that-- to quote Buck directly-- "fills some of the gaps in V1". You can obtain tfpt.exe from the Visual Studio 2005 SDK. Unfortunately the SDK is still in beta; in the latest March CTP, tfpt.exe is located in this folder:

C:\Program Files\Visual Studio 2005 SDK\2006.03\VisualStudioTeamSystemIntegration\Utilities\Team Foundation Power Toys

Here's the basic help text for TFPT; Buck's word documentation goes into much more detail.

TFPT - Team Foundation PowerToys

Type tfpt help for full description

Commands:
tfpt annotate Display line-by-line change information for a file
tfpt getcs Get only the changes in a particular changeset
tfpt history Show the history of an item
tfpt online Pend adds, edits, deletes to writable files
tfpt review Review (diff/view) workspace changes
tfpt rollback Pend changes to roll back a changeset
tfpt unshelve Unshelve into workspace with pending chanages
tfpt uu Undo changes to unchanged files in the workspace

As you can see, there are a number of interesting, useful commands here that you can't accomplish from within the Visual Studio IDE (yet). The particular command we're interested in is Undo Unchanged, which is equivalent to the "Revert files that were not changed" command in Microsoft's internal Source Depot version control system:

The uu command pares down your checkouts to only the files that have actually changed, and it undoes checkouts for files that haven't actually changed.

This is useful in a number of circumstances. In our case, we have to do this because of the subfolder file overwrite bug in Team System RTM.

Let's start by checking out all the files in a subfolder of a solution:

We now drag and drop (or add via the menus; doesn't matter which) a modified copy of TextFile1.txt into the Subfolder of the solution, overwriting the existing one. We could have added 1 file, or 50 files. Now we don't know how many files have actually changed, as our pending changes shows everything in the subfolder. Sure, we could just check everything in and see what actually gets resolved, but maybe we'd like to know what we're checking in before we do it, eh?

Let's run the Undo Unchanged command to get rid of the non-modified files. Note that this has to be run from a path somehere in your workspace or you'll get a "unable to determine the workspace" error.

C:\Projects\ConsoleApplication1>tfpt uu
Bringing the workspace up to the latest version...
Getting the list of pending changes for your workspace...
Building the list of redundant changes...
edit (contents match): c:\projects\ConsoleApplication1\ConsoleApplication1.csproj.vspscc
edit (contents match): c:\projects\ConsoleApplication1\ConsoleApplication1.csproj
edit (contents match): c:\projects\ConsoleApplication1\Subfolder\Class1.cs
edit (contents match): c:\projects\ConsoleApplication1\Subfolder\Class2.cs
edit (contents match): c:\projects\ConsoleApplication1\Subfolder\Class3.cs
Do you wish to undo these redundant pending changes? (Y/N) Y
Undoing redundant changes...
Undoing edit: ConsoleApplication1.csproj
Undoing edit: ConsoleApplication1.csproj.vspscc

Subfolder:
Undoing edit: Class1.cs
Undoing edit: Class2.cs
Undoing edit: Class3.cs
5 changes undone.

Now if we refresh our project display, we see that the pending changes are reduced to only the file we actually changed:

Now we know which files we overwrote in the solution.

posted on Tuesday, April 04, 2006 3:15 PM by jatwood

Comments

# re: The Team Foundation Power Toy and Undo Unchanged

I'm glad you like the tool. While I did write uu and getcs (the two with odd names :-), the original tfpt code was written by Philip, who was an intern with us last year. He did a great job and also wrote the Word doc. Several other developers have contributed to it now as well.

The next release will contain the first work item tracking commands. You'll be able to query, update, and create work items from the command line with tfpt.
Tuesday, April 04, 2006 4:34 PM by Buck Hodges

# VSTS Links - 04/05/2006

Omar Villarreal, a Team System Rocks! Blogger, has some Tips for Fast Team Build Script Troubleshooting....
Wednesday, April 05, 2006 6:44 AM by Team System News