TFS Source Control Comparisons and Whitespace
Not a usual post about SharePoint or Office, but something that I hope may help some people who find the same issue I did with TFS. I found a problem today with Team Foundation Server (TFS) when trying to compare some changes I had made against the latest version held within source control – by default it appears as if TFS uses diffmerge.exe and passes the /ignorespace option which means that changes that consist solely of whitespace are ignored and the files are deemed to be identical.
Consider the following example where you have a source file in TFS containing the following line of code:
String example = "this is an example string";
You then check out the file and edited the file to add extra whitespace at the start of the string as shown below:
String example = " this is an example string";
Within TFS, if you do a comparison of the file, TFS tells you that the file is identical to the latest version that is checked in on the TFS server. Clearly this is not the case, and it due to the fact that by default TFS passes the /ignorespace option to the diffmerge.exe tool it uses to compare files.
To solve this issue follow the steps below to specify a custom tool to use for comparing files (note, we're still going to use the standard diffmerge.exe tool, but we're not going to specify the /ignorespace option):
- Within VS.NET 2005 select the "Tools -> Options" menu item.
- Expand the "Source Control" node and select "Visual Studio Team Foundation Server".
- Click the "Configure User Tools…" button then click the "Add" button to add a new tool.
- Configure the settings for the tool to be the following:
- Extension: set this to be ".*" i.e. dot star.
- Operation: ensure this is set to "Compare".
- Command: set this to be "C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\diffmerge.exe" which is the default path to the diffmerge.exe tool.
- Arguments: leave this as standard i.e. leave this as "%1 %2".
- Extension: set this to be ".*" i.e. dot star.
- Click OK all the way back up the dialog hierarchy to save the settings.
If you now compare the file that we previously modified and added the whitespace to, TFS will correctly show that the files differ on the modified line of code.
0 Comments:
Post a Comment
<< Home