Search code examples
visual-studio-2013tfsbranchchangeset

Get parent changeset number after branching by changeset in TFS 2013


I'm currently using TFS 2013 Update 3 with TFVC, along with Visual Studio 2013 Update 3.

Let's say there is a branch A, with a series of changesets, e.g. 11346, 12345, 12897. Then a branch B is created from branch A and changeset 12345 (Branch from Version, By Changeset).

At this point, from Visual Studio, it's easy to check that branch B is a child of branch A (e.g. right click on branch B -> Advanced -> Properties -> Relationships) but, is there also a way to know that branch B was branched from the particular changeset 12345?

At the moment, when branching by changeset, I explicitly write the changeset number of the parent branch in the description of the new child branch; however, I was wondering if that information is available "automatically" somewhere, just like the relationship of the two branches as mentioned before.

It'd be OK even if such information could only be retrieved through the command line.


Solution

  • The TFS functionality to use is the Track Changeset.

    See View where and when changesets have been merged in the MSDN documentation.

    By opening the Tracking Changeset window, you can determine which branches have and have not received a set of changes.

    It's then possible to find the original parent changeset number of a branch that was created with a branching-by-changeset operation.

    Basically, these are the actions that can be done from Visual Studio following the scenario showed in my question (branch A: parent branch, branch B: child branch):

    1. From the Source Control Explorer window, right click on the child branch -> View History
    2. Identify the first (older) changeset of that branch and right click -> Track Changeset
    3. In the branch list, the child branch should be selected by default; make sure that the parent branch is also selected and also add the child branch to the Path filter through the Browse... button
    4. Click on the Visualize button, the Tracking Changeset window appears
    5. By defaut, the Hierarchy Tracking view is displayed: the parent branch shows the list of changesets, where the last one is the one of interest. Alternatively, the Timeline Tracking can be used. These two views show clearly the relationship of the two branches, when the child branch was created and the parent changeset number that the child branch originated from.