views:

54

answers:

2

When i create a branch from the mainline in TFS 2010 i have to download all of the code i have just branched.

I already have the latest mainline version on my laptop so why is TFS requiring me to effectively download whats already on my hard disk?

Even if i copy the mainline files into a folder and map the new branch to this folder it still performs a fully recursive get and chokes our bandwith for 30 minutes or so.

This seems like such a waste of time and bandwith - is their a workaround/procedure that i am not aware of?

A: 

The reason for that is that TFS doesn't know that you have the branch downloaded. The act of "getting" actually puts a record in the TFS database that indicates which version of the code you have in your workspace. That way, it knows whether you have latest or not.

I'm surprised that a "get" is taking more than 30 minutes. Is your TFS server remote? Are you getting more binaries than you need to? If you have a remote server, you may want to consider using the TFS proxy to help with performance. Though it won't solve this particular issue you have, it may speed things up for other developers.

One final question: why are you branching so much? Though I understand the idea of branch on feature, and that it increases the number of times that you'll need to branch, it should still be a relatively infrequent occurrence. And if it is rare, then, yes, the thirty minutes to download may be annoying, but you'll need to ask yourself if it really is a problem.

Robaticus
Yes our TFS server is remote, and the solution contains many projects, some containing lots of media etc. Hence the lengthly downloads at busy times of the day. I am not branching 'so much', Just when features and the complexities of different customer requirements demand it. Sometimes this is as little as twice a month, sometimes a lot more. Either way you shouldnt have to download an entire set of something that you already have on your machine - which is what SVN does with the switch command. Luckily TFS has remap as highlighted below :-)
Baldy
the /remap is a great idea. We hadn't needed to do that yet, but it's a good one to put in my toolkit.
Robaticus
+6  A: 

For faster switching between branches, give the tf get /remap option a try. From Brian Harry's blog:

This is a new option on tf get that is intended to be used when you want to switch your workspace from one branch to another in the same code base. You first change the workspace mapping and then issue a tf get /remap. Because a large percentage of the files in two related branches are frequently identical, this command optimizes for that. Rather than downloading all the content, it will only download the things that are different between the two branches. I can reduce the get of a very large workspace from 10's of minutes to a few seconds.

Note that this requires TFS 2008 SP1 or later.

Jim Lamb
this is exactly the kind of functionality i was hoping to find. Much like the SVN switch command. Thanks!
Baldy