Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't nest TFS branches, so branching to share code doesn't work?

Tags:

branch

tfs

shared

I've been following the advice in "Team Development with Visual Studio Team Foundation Server" on structuring projects and sharing code from one team project into another using branching. So our source tree looks like this:

server\instance
  Shared
    share
  Project1
    Main
      Product1
      share   (branched into Project1 from Shared)
    Stories
      1607
      1832

Or at least it should.

As you can see, as well as branching in some shared code, we also use branch per user-story.

The problem is, when I try to branch in the share folder from the Shared project (Source Branch Name: $/Shared/share; Target Branch Name: $/Project1/Main/share), I get the error:

TF203028: You cannot create a branch at $/Project1/Main/share because a branch already exists at $/Project1/Main.

It is documented that you cannot nest branches in TFS, so the error is not surprising. Thus it appears that I am scuppered and the Team Development book is wrong. (The book implies that this should work.)

But appearances can be deceptive and I'm more likely to be wrong than the authors of the book. Can anyone help me understand how to fix this?

(One obvious solution would be to make the root of the story branches a sibling of share, rather than a parent. But this won't be any use to us, because it would mean that we would be unable to make changes to the shared code in a story branch, which rather defeats the object of branch per story. It would also mean a fairly colossal amount of work changing paths in the projects.)

like image 473
Ian Goldby Avatar asked Apr 04 '12 14:04

Ian Goldby


1 Answers

I found the solution.

TFS showed a branch icon against Project1\Main, rather than a folder icon. I went to File>Source Control>Branching and Merging>Convert to Folder and converted it back to a folder. I was then able to branch share into Project1.

Oddly, Main is still a point off which story branches are made, and those branches still exist.

The real solution was that I had to make the places where the shared code was branched into the project normal folders, rather than the branch icon. I went to File>Source Control>Branching and Merging>Convert to Folder and converted it back to a folder. I was then able to create branches off Main.

The branch off Main, and the story branches retained their branch icons. share now looks like an ordinary folder.

like image 154
Ian Goldby Avatar answered Sep 20 '22 13:09

Ian Goldby