Sunday, July 21, 2013

Apply Check-In Policies to only certain Branches or Folders

Apply Check-In Policies to only certain Branches or Folders

First install the TFS 2010 Power Tools by downloading it to your Client box. This has to be installed on each Client box on which Visual Studio 2010 is installed.

Then go to Source Control as shown below:


Once you installed the Power Tools, you should see a new set of Check-in policies in place as shown below.


Note that it says that “This policy scopes other policies to specific folders or file types, and there you have it. So what it means is essentially you could create some other policy and use that as a child to this policy and then constrain it to be triggered for checking only if the check-in happens to go under the folder or branch that you specify in its scope.


To further illustrate this:
Below I have created a “Code Analysis” policy, and then used it as a Child policy for the “Custom Path policy” and scoped it to apply to the “DEV” branch. You can just enter a matching string for regexing into the particular branch you want to.
If this is not what you are seeking, then you might also consider writing a custom check in policy. Note that policies are evaluated at the client prior to check-in.