Version Control API changes in TFS 2010 - part II

Yesterday I was talking about changes we did to itemId and pendingChangeId in TFS 2010. Today I want to list other changes, related to various part of VC api:

  1. You should be careful when using DiffItemVersionedFile class, especially if you use constructor that requires itemId. Much safer thing to do is to call Difference. CreateTargetDiffItem. It will use QueryHistory under the covers to find correct item, but it has optimizations for most common cases that will avoid it.
  2. VersionControlServer. GetBranchHistory returns objects that are result of both branching and renaming items. BranchRelative.BranchToChangeType contains information about the operation that created given branch, however this is not recommended to try mimicking Orcas behavior by pruning results of GetBranchHistory. In some cases, like cycles in renames, it’s not possible. Instead new method VersionControlServer. QueryMergeRelationships should be used, which returns all items that have merge relationship to the specified item (i.e. not only branch relationship, but also merge relationship).
  3.  Labels in TFS 2010 include deleted items, in oppose to labels in TFS 2005 and TFS 2008
  4. VersionControlServer.GetItems and Workspace.GetExtendedItems do not returns items that were deleted as part of rename, unless GetItemsOptions. IncludeSourceRenames was specified

Enjoy!