Visual differences of changesets via command-line

August 24, 2009

Scenario : as a developer you want to manually view all the differences between the two last changesets without having to spend your time reviewing file after file in the UI differences window.

Go the command prompt and use the tf diff[erence] command:

tf diff source /version:C22~C23 /recursive /format:unified > C:\Temp\diff.txt

  • source is the name of the folder I want to recursively [/recursive] look up all differences
  • /version:C22~C23 means that I want to find only the differences between changeset 22 and changeset 23
  • /format:unified sets the output type to the Unified format derived from the UNIX based diff –u output format
  • > C:\Temp\diff.txt sends the output to the diff.txt textfile

When finished open the diff.txt file in an editor that supports a difference scheme. In the example below I used Notepad2 to load the output file in the diff scheme.

The information written into the textfile is only the specific region in each textfile that’s different from the previous changeset. It’s a nice way to visually review only the portions of a set of files that were changed. It will save you a lot of time if you otherwise would want to review file by file via the GUI.

DYK #4 : unshelve with local pending changes

April 5, 2009

You might already have been in the situation where you wanted to unshelve a stored shelveset when having local changes to files that were also changed in the stored shelveset. Out-of-the-box with TFS 2008, this is not possible and you will get the following error dialog :

Your local workspace may not contain pending changes on files that are included in the shelveset. However, there is a way to unshelve with local pending changes. Therefore, you need to have the Power Tools installed for Team Foundation Server.

From the command-line you can execute the tfpt unshelve command with the name of the shelveset to accomplish that.

tfpt unshelve allows a shelveset to be unshelved into a workspace with pending changes. Merges content between local and shelved changes. Allows migration of shelved changes from one branch into another by rewriting server paths.

Like in a normal get latest scenario, you will be asked to resolve conflicts and eventually be redirected to the well known TFS merge window.

DYK #3 : retain build indefinitely

March 17, 2009

If you hold on to a specific Team Build retention policy (new since TFS2008), you might lose all valuable build information of a particular build that you actually wanted to keep.

There’s an option available via the Build Explorer to retain builds indefinitely!

DYK #2 : TFS auto-connection

March 5, 2009

By default, Team Explorer always tries to automatically connect at startup to the latest known Team Foundation Server. In my case I often start Visual Studio Team System at home when I was previously connected to the Team Foundation Server at work. So, when disconnected from work, I always get the TF30331 error …

Today, this error hit me for the last time! On the Developer Support Team Foundation Server blog I found how to disable the auto-connection! Sweet!

To make this happen, add a DWORD value called “AutoLoadServer” under HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0\TeamFoundation (for 2005 – change this to 9.0 for Orcas). A setting of Zero means do not reconnect automatically.

DYK #1 : IIS not required for Team Build

February 22, 2009

DYK = Did You Know?

Internet Information Server (IIS) is not required to be installed for a TFS 2008 Team Build machine

The application server for TFS 2005 still used .NET Remoting to communicate with the Team Build machine, but as from TFS 2008 the communication is set up with Windows Communication Foundation. The WCF service runs in a managed Windows Service (TfsBuildService.exe).