In the last three installments of this column, I explored the team Foundation Server (TFS) Versioning and work item tracking APIs. I used these APIs to build a Microsoft®word 2003 add-in that supports check-in and work item associations for Word documents, similar to the capabilities of Team Explorer in Visual studio®2005. In this installment, I'll delve into the check-in notes and policies. You'll learn how check-in notes work and how to write your own custom policy implementations. In a future column, I'll add this support to the Word add-in.
Check-in Notes and Policies
A check-in note is a free-form text field that you can use to add string data for a category to a check-in. Check-in notes are defined at the team project level and can be enforced as part of a check-in operation. The default project templates provided by Microsoft define three check-in notes: Code reviewers, security reviewers, and performance reviewers. None of them are mandatory; you can define your own check-in notes by using Team Explorer and/or APIs after you create the team project, or by modifying the Versioncontrol.xml file in the process template before you create the team project. When you define a check-in note, you define a label of up to 64 characters, specifying whether the description is required at check-in and specifying where the description will appear in the Check-in form. When checked in, the value of the description can contain up to 2048 + (230–1) characters. The first 2048 characters are stored in the nvarchar column of the database-any excess portions will be stored in the ntext columns.
The check-in policy enforces the rules defined by the team project administrator. Policies can be simple, such as making sure that you enter comments at check-in and can be complex, such as performing static code analysis and running tests. The 2005 version of TFS shipped with three policies. Subsequently, Microsoft has added four additional check-in policies as part of Microsoft Visual Studio's Foundation Server power Tool. Figure 1 provides detailed information about all seven policies. (Of course, it's "Tool" rather than "Tools".) See msdn2.microsoft.com/aa718351. )
Figure 1 Microsoft-provided policies
Run the test specified by the policy test list before checking in. You can control the list of tests that the policy runs.
policy |
release |
policy requires |
work item |
rtm |
at least one work item is associated with the check-in. There are no configuration options. |
|
rtm |
|
test |
rtm |
|
|
Forbidden mode |
power Tool |
|
work item query |
power td> |
|
custom path |
power /td> |
|