4

I have a Team Foundation Server 2013 code structure like follows...

$/TeamProject/Application/AllTheCodeFiles

...but I'd like to refactor to have...

$/TeamProject/Application/Trunk/AllTheCodeFiles

Which will allow me to implement a branching and merging strategy moving forward by creating "Release" branches at the same level as "Trunk".

If I try to either branch or move the Application directory into Trunk, I get the error message:

The target item $/TeamProject/Application/Trunk cannot be under the source item $/TeamProject/Application.

So, here's the process that I followed, it feels wrong and I'm guessing that there's a more efficient way of doing this.

  1. Rename $/TeamProject/Application to $/TeamProject/Application-trunk
  2. Create a new $/TeamProject/Application directory
  3. Move $/TeamProject/Application-trunk to $/TeamProject/Application/Trunk

After doing this, history is associated with $/TeamProject/Application not $/TeamProject/Application/Trunk. My question is this, someone who knows more would do this in what manner?

Jeroen
  • 60,696
  • 40
  • 206
  • 339
Pattrick King
  • 1,172
  • 8
  • 13

1 Answers1

7

I've just gone through what I would do on my Test TFVC and things seem OK version history wise.

Here are the steps:

  1. Start with $/TeamProject/Application/
  2. Create a Folder at $/TeamProject/Application/Main/ (TFVC Convention - Trunk is SVN)
  3. Check in pending changes.
  4. Move all files and folders from $/TeamProject/Application/ to $/TeamProject/Application/Main/
  5. Check in pending changes.
  6. Convert $/TeamProject/Application/Main/ to a branch.

Here's the history of a file that was added (C58) and edited (C59) before the move (C62) and then edited (C63) after the move:

History

DaveShaw
  • 52,123
  • 16
  • 112
  • 141
  • 1
    Dave, thanks a ton for this. I followed this process and was able to view the history of individual files like you indicated. What I am unable to do now, though, is to create a branch from $/TeamProject/Application/Main to $/TeamProject/Application/Release by changeset. If I try to do this, the only changesets I can select from $/TeamProject/Application/Main are the two commits from this process (add main and move to main). – Pattrick King Aug 22 '14 at 20:30
  • That makes sense, because before the "move" changeset (C62), there wasn't an $/TeamProject/Application/Main. – DaveShaw Aug 23 '14 at 09:56
  • Hi Dave, is there a workaround for this? I'm implementing branching in an old codebase and I need to create a branch from several dozen changesets before the Main branch was created. It's impossible to branch from the top-level, so I guess I'll have to download the version I want and commit that as the first changeset for the release branch - losing all the history? Is there any other way? – Dave Novelli Jul 15 '15 at 20:52