Inside VSTS

Branching in Visual Studio 2010

The new branch visualization feature brings order to the chaos of branching and merging.

Every once in a while, I like to talk about upcoming features in Visual Studio 2010. Even though it's a ways off, it's good to know where the tool is heading and how it can make your life easier.

Take branching and merging; this is already difficult enough. One limitation in Team System today is that you can't easily visualize your branching structure so it's difficult to understand the movement of code from branch to branch. Fear not -- branch visualization is here!

Before we go any further, note that this is based on pre-release software (October CTP) and, as such, is subject to change.

Now, the problem with branching in TFS is that you can't "see" what you're doing. If you're like me (I'm a very visual person), pictures can communicate ideas much more succinctly than explanations. That's where VS 2010's branch visualization comes in.

Let's take the following scenario: I want to know the history of changeset 24. Looking at a list of information, I could see that changeset 24 included code from changeset 9 and that code from changeset 24 was included in changeset 29. Changeset 9 was on the integration branch and it moved the main branch which created changeset 24. Likewise, changeset 29 was the result of a merge from the main branch to the test branch. (Have I lost you yet? Because I'm confused and I wrote it!)

Now, take a look at Figure 1, which shows the visualization view of changeset 24. Much easier to understand, isn't it? It also tracks changes to changeset 9 because that code was also involved in changeset 24.

To get to the branch visualization, you need to view the history of a given item. Branch visualization is designed to allow you to trace changesets across branches. In order to get to the point where you can visualize the changeset, you need to view the history of the given item. Figure 2 shows the new history dialog (note also that you can easily see the labels in which the file participates). As a side note, the history view now shows you the history across branches -- a view you don't get in TFS 2008 unless you use the history power tool.

Let's take a more expansive look and check out the details of changeset 29 (Figure 3). You can see how this would be incredibly difficult to put into words. This view allows you to communicate the movement of code with very few words but still get a clear understanding of what went where. But that's not where visualization stops -- it's merely the beginning. You can also get a view of the overall branching hierarchy in your application (Figure 4).

But wait...in true Ginsu commercial fashion, there's more! You can actually work with this diagram. Through it, you can perform comparisons between changeset versions on different branches, create new branches (another cool feature of 2010 is server-based branching, which is incredibly fast because you don't have to have the files on your local machine), merge two branches together, set branch permission, or view the changeset files in Source Control Explorer.

Part of this is made possible because branches are now what are called "first-class citizens" in TFS. That is, they're treated as special entities. In TFS 2005 and 2008, you'll note that branches are denoted by a folder icon and you can't perform any specific branch-related commands on just those items (it's also time-consuming to determine what's a branch and what's a folder). In 2010, you need to specify what the root branch is (and when you create new branches, they're automatically marked as such).

About the Author

Jeff Levinson is the Application Lifecycle Management practice lead for Northwest Cadence specializing in process and methodology. He is the co-author of "Pro Visual Studio Team System with Database Professionals" (Apress 2007), the author of "Building Client/Server Applications with VB.NET" (Apress 2003) and has written numerous articles. He is an MCAD, MCSD, MCDBA, MCT and is a Team System MVP. He has a Masters in Software Engineering from Carnegie Mellon University and is a former Solutions Design and Integration Architect for The Boeing Company. You can reach him at [email protected].

comments powered by Disqus

Featured

  • Compare New GitHub Copilot Free Plan for Visual Studio/VS Code to Paid Plans

    The free plan restricts the number of completions, chat requests and access to AI models, being suitable for occasional users and small projects.

  • Diving Deep into .NET MAUI

    Ever since someone figured out that fiddling bits results in source code, developers have sought one codebase for all types of apps on all platforms, with Microsoft's latest attempt to further that effort being .NET MAUI.

  • Copilot AI Boosts Abound in New VS Code v1.96

    Microsoft improved on its new "Copilot Edit" functionality in the latest release of Visual Studio Code, v1.96, its open-source based code editor that has become the most popular in the world according to many surveys.

  • AdaBoost Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the AdaBoost.R2 algorithm for regression problems (where the goal is to predict a single numeric value). The implementation follows the original source research paper closely, so you can use it as a guide for customization for specific scenarios.

  • Versioning and Documenting ASP.NET Core Services

    Building an API with ASP.NET Core is only half the job. If your API is going to live more than one release cycle, you're going to need to version it. If you have other people building clients for it, you're going to need to document it.

Subscribe on YouTube