Quick Response Sample – Command line utility to create TFS Branch Scenarios
Quick Response samples provide information directly from Visual Studio ALM Rangers working with the Microsoft Visual Studio Product Group and Microsoft Services, in response to feature gaps to supplement the product and knowledge base information.
Update 2012/11/22 – Please refer to the Quick Response Sample – Visual Studio Extension to support the ALM Rangers Branching and Merging guidance for the latest information and Visual Studio extension support for this quick response sample solution.
It is not simple to implement a consistent branching model as part of team project or team creation process, that complies with the VS TFS Branching and Merging Guide.
Team Foundation Server has extensive support for version control and branching management through the object model. You can create your own solution, using the sample command line tool, in the Quick Response download package.
To use the sample, proceed as follows:
- Rebuild the sample code using Visual Studio 2012, whereby you require the TFS Object Model (OM).
- Run the TfsBranchTool.exe command line tool with the /? parameter to get started.
- TfsBranchTool /?
- TfsBranchTool “Main only” /?
- TfsBranchTool “Main only” /ProjectCollectionUrl:”http://vstsr-vm2012rtm:8080/tfs/DefaultCollection” /TeamProject:QRTest /RootFolder:”$/QRTest/cmdline/test/mainonly”
- TfsBranchTool Basic /ProjectCollectionUrl:”http://vstsr-vm2012rtm:8080/tfs/DefaultCollection” /teamproject:QRTest /RootFolder:”$/QRTest/cmdline/test/basic”
- TfsBranchTool Feature /ProjectCollectionUrl:”http://vstsr-vm2012rtm:8080/tfs/DefaultCollection” /TeamProject:QRTest /RootFolder:”$/QRTest/cmdline/test/feature” /FeatureName:f-One
- ALM Ranger Contributor(s) Esteban Garcia, Mattias Sköld, Tomas Scott and Vladimir Gusarov
- ALM Ranger Reviewer(s) Michael Fourie | Willy-Peter Schaub
- Product Owner/SME: Micheal Learned
Coffee break with the team
- Mattias why did you sign up to lead this quick response solution, which is now your second?
I’ve used the Branching guidance a lot, hate manual work, and missed an integrated and automated solution. This was a great opportunity to build something really useful. Once I started to think about a vision for what we could accomplish I was stuck. Knowing I could do it, together with some great people from across the globe, it was a no brainer…
- Vladimir what is the rules engine all about and why did you pick the implemented design?
The actions engine (aka Rules Engine) was designed as very abstract object model which allows defining any sequence of actions and execute them in order. The idea was to split branch tool operations into basic actions like create SCC folder, perform branch, check in, etc. Combining those basic actions into different sequences provides us ability to cover different branching models we have in the guidance. We anticipated that branching models may change frequently and there may be necessity to add more basic operations in the future. Given that, we designed action engine to be configured through XML and to be extendable even without recompilation. Design was very simple and powerful – XML lists all actions and parameters. You may pass output parameters to next action through the macro-expandable properties. Each action identified by name and engine loads action’s handler as add-in through the Managed Extensibility Framework.
- Tomas what is special about the command line parser?
The command line parser is not so special, but the characteristic very much align with the Action Engine in that it does just reflect that parameters from the xml config files. So first it asks for the commands available, and then the parameters for that command. The challenge has been to build a piece of software that interacts with another piece of software without that much of a specification and very little communication except for immediate questions. It has been interesting to realize that when you think you are finished you get aware that there is something you missed. That is due to the fact that it is a Quick Response solution, that you work for just a few hours a week and cooperate with people over several time zones that puts in their weekly effort in other days than your own – this makes it really interesting, inspiring and challenging! It is nice to work with really talented and devoted people!
- Esteban what nuggets can you share after working with Mathias to design and implement the version control logic?
Testing the version control logic proved to be a bit tricky since we couldn’t assume that we would always have an available TFS server to test against and of course, we were not verifying TFS’s functionality. So we decided to take a look at the new Fakes framework to mock all TFS functionality. This was a really rewarding experience as we were able to unit test our version control logic without any dependencies on TFS.
Other important highlights
- Visual Studio Team Explorer extension … coming soon!
- Team Project creation wizard extension.
- Work with the ALM Rangers / ALM MVPs to extend the tooling for the community