官术网_书友最值得收藏!

Reparenting a branch in TFVC

Team Foundation Version Control provides you with an option to prune a branch from somewhere in a given hierarchy and graft it on elsewhere in the same hierarchy. Consider using this approach if the branch structure you put in place is incorrectly set up or has stopped working as you have scaled up. In this recipe, you'll learn how to reparent a branch in TFVC.

Note

The movement of the reparented branch is logical not physical and can be done without stopping developers from working. However, it's a good idea to get developers to shelve changes. You should also endeavor to make the new parent as close in content to the old parent to avoid merge conflicts.

Getting ready

In order to reparent a branch, your user account needs to have the Manage branch permission. The project administrator group and project collection administrator group already grant this permission; however, this permission can be set to allow directly on individual users and groups:

The Manage branch permission allows you to perform the following:

  • Convert a folder into a branch
  • Execute the following actions
    • Edit the branch properties
    • Reparent the branch
    • Convert the branch into a folder

In your TFVC project, create a branching structure as illustrated in the figure on the left:

The scenario we'll be working through in this recipe, as illustrated in the figure on the left, is the Development Team releases from the Main branch; Release 1.1 was branched from Release 1. As illustrated in the figure on the right, the Team wants to move Release 1.1 directly under the Main branch, so changes don't need to go through Release 1 to be merged to Release 1.1.

To reparent the branch Release 1.1 from Release 1 to Main, a relationship needs to be established between the two branches. This can only be done by performing a baseless merge between the two branches. Refer to the Performing a baseless merge between sibling branches in TFVC recipe to learn how to perform a baseless merge.

This recipe assumes that a merge relationship has been established between the Main and Release 1.1 branch. In the preceding figure, the dashed line represents a relationship between the two branches.

How to do it…

  1. Navigate to Source Control Explorer, right-click on the branch Release 1.1 and choose Reparent... from the Branching and Merging submenu:
  2. In the Reparent window, you'll see a list of all branches that have a direct or indirect relationship with Release 1.1. Select Main and click on Reparent. Selecting No parent will make Release 1.1 an independent branch:
  3. The reparent operation takes place on the server. You will not see any pending changes as a result of the reparent operation. The branch hierarchy after the reparent operation is as follows:

How it works…

Once the reparent operation has been completed, you can view the updated branch hierarchy by right-clicking on the Release1.1 branch and choosing Properties from under the Advanced submenu:

Click on the Relationships tab from the left menu to see the branch relationships.

主站蜘蛛池模板: 丰镇市| 朝阳区| 五华县| 安宁市| 龙游县| 眉山市| 眉山市| 洪江市| 东山县| 芜湖县| 望奎县| 临城县| 大荔县| 井研县| 南江县| 武平县| 南和县| 盈江县| 界首市| 东港市| 静宁县| 理塘县| 奉化市| 塔城市| 安仁县| 涞源县| 抚远县| 鄯善县| 开封市| 察隅县| 启东市| 武定县| 铜梁县| 英超| 莆田市| 东明县| 施甸县| 罗平县| 江都市| 镇安县| 太湖县|