Customizing the Team Foundation Tree Difference (TreeDiff) Power Toy
Before we get started on Tree Difference customization, I would like to bring forth some known bugs and their work-arounds. The bugs and their work-arounds are discussed in these blog postings:
- File extension masks do not work
- Get latest and some version control operations from inside the tree difference viewer results in file-not-found I/O exception
With the bugs out of the way, let's talk about customizing the Tree Difference.
Tree Difference uses a couple of registry keys. Except for the View Options, all other settings are only available via direct access to the registry.
- HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0\TeamFoundation\PowerToys\TreeDifference\NonRelevantMasks. You can use values in this key to filter out selected files and folders from the results. These masks are applied to both the server and local paths.
- FileExtensions: This is a list of semicolon-delimited file extension masks. Any file with an extension matching one of these extensions are excluded from the results. Due to a bug (discussed above), do not include the '*' wildcard in the masks. There is no support for wildcard file name matching or file inclusion masking in the Tree Difference power toy release. Default value is: *.pdb;*.obj;*.dll;*.exe;*.res;*.resources;*.cache;*.ilk
- FolderExtensions: This is a list semicolon-delimited folder name masks. Any folder with name matching one of these names are excluded from the results. Do not include '*' wildcard in the masks. Similar to the file extension exclusions, there is no support for wildcard folder name matching or folder inclusion masking in the power toy release. Default value is: obj;objd. You may want to also add "bin".
- HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0\TeamFoundation\PowerToys\TreeDifference\ViewOptions. You can use these values to further control which items to be shown in the results. In addition to directly accessing these registry values, these four options are also available in the context menu in the tree difference results list.
- ShowSourceOnlyItems: Set to True to show items that only exist in the tree on the left. Default is True.
- ShowTargetOnlyItems: Set to True to show items that only exist in the tree on the right. Default is True.
- ShowDifferentItems: Set to True to show items that are on both sides but having different contents. Default is True.
- ShowEqualItems: Set to True to show items that are on both sides and having identical contents. Default is False.
- HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0\TeamFoundation\PowerToys\TreeDifference\Colors. These colors are specified in ARGB32 dot notation: A.R.G.B where A is the alpha value (0-255), R is the red value (0-255), G is the green value (0-255), and B is the blue value (0-255).
- SourceOnlyItems: Text color for items that only exist on the left side. Default is blue.
- TargetOnlyItems: Text color for items that only exist on the right side. Default is dark green.
- DifferentItems: Text color for items that have different contents. Default is red.
- EqualItems: Text color for items that have identical contents. Default is black.
- NonDownloadedItems: Text color for local files that are mapped to a server location but whose content has not been downloaded. This color is only applied to the local file name. Default is medium gray.
- ColoringForEvenRows: Background color for the even-numbered rows. The different even/odd row background colors can help visually distinguish adjacent rows. Default is very light gray.
- ColorForOddRows: Background color for the odd-numbered rows. Default is white.
There is one more setting that is available from Visual Studio Tools > Options > Team Foundation Server Power Toys > General. In this page, there are actually two settings: one for Annotate and the other for Tree Difference. Setting the Tree Difference value to False disables the Tree Difference feature in Visual Studio. Once disabled, the tree difference context menu item in Source Control Explorer will no longer be visible.
This wraps up Tree Difference customization. Stay tuned!