tags:

views:

34

answers:

2

I just migrated a team of 7 developers from VSS to TFS. I migrated all of their code into a DEV folder which I then branched into a QA folder (which I branched into a PROD folder). The developers usually don't work on the same files, but there are some shared utility classes. All of the code is for a large ASP.NET web site. When the developers are ready to merge from DEV to QA, they only want to merge their changes. For example, let's say that Developer1 has been working on a project for the last 3 months and he's ready to merge all of his code into QA. However, Developer2 has been working on a different project for the last 2 months which is not ready to be merged. Developer1 and Developer2's changes are not in any way dependent on each other, but they are not separated into different folder structures and they each regularly do a get latest. There doesn't seem to be a way for developer1 to only merge his changes without also merging all of developer2's changes. Currently, developer1 is going through the Pending Changes window and 'Undoing Pending Changes' for all of Developer2's changes, but this is time consuming. They could merge each file individually, but this is also time consuming. Is there an easier way? I am going to have a coronary if I hear one more person explain how much easier it was to work in VSS.

A: 

It sounds like the best strategy (going forward) is to branch-on-project. If Dev1 and Dev2 are working on fundamentally different things, they should each have their own branch of the code.

Keep in mind that everything in TFS is stored as deltas and pointers, so you aren't massively increasing the size of your repository by doing this. Until the file changes, the new branch is only a pointer to the original file, then when the file is checked in, only the delta is stored.

In your current situation, you're doing what's called a "cherry-pick" merge. This is not a fun thing to do (as you are finding out), and it is prone to PEBKAC errors. For this reason, cherry-pick merges are strongly discouraged. However, if you do need to do cherry-pick merges, you can put some control around by merging by changeset (instead of latest).

To do this, identify the changesets that Dev1 has checked into your Dev branch, then merge those changesets into your mainline branch. You'll need to do it in order from oldest to newest to be sure to get all of the files. Your best bet, if you are going to do this, will be to either write a utility to do it, or move down to the TF.EXE command line, so you can batch your merges together.

Remember to do your merges in a clean workspace, and you can batch up all of your merges before you check in.

The key lesson you are learning here is that your branching strategy/methodology is one of the most important things about SCM (in general). We migrated from StarTeam to TFS a little over a year and a half ago, and when we did, we spent approximately 4 months revising our branching approach until we came up with something that fit our environment and our development processes.

Robaticus
It's really our web master that makes this difficult. He mainly changes HTML and CSS but he's changing .aspx pages all over our directory structure. For the most part, the devs can separate their projects into different folders (except for shared code), but because of the fact that we have a web master responsible for the .aspx pages, it makes it impossible to separate his work into separate folders. Yes, we could make this separation by moving to an architecture like ASP.NET MVC or by putting our code behinds in different folders,
JacksonD
but there's a huge base of legacy code and that would be a months-long undertaking. We are not currently doing any cherry-picking. We always merge the latest version of files. I've considered giving the web master his own DEV branch which he could then merge into QA, but that seems like a lot of complexity to introduce to solve this problem - for example, the devs would then have to periodically (at least once a day) merge from QA to DEV to get the web master's changes. Thanks for your response.
JacksonD
branching for the webmaster is perfectly reasonable. Regarding the merge from QA to DEV daily, that's a good practice to get into, and they should be able to do it from their solution explorer (right click, get latest). It's the way I have our developers doing it.
Robaticus
A: 

Is there a reason that they seem to be branching all changes instead of just their own changesets?

The merge dialogue specifically asks whether you want to branch "all changes up to a specific version" or "only specific changesets." If you choose the latter then you can cherry-pick your changes and don't need to take everyone's code. Assuming each dev is working on a non-overlapping set of files, this isn't something that should be causing you problems.

Dan Puzey
I've read that cherry-picking should be avoided. One of the users is more of a web master. i.e. he works mostly with HTML and CSS in the .aspx pages and he makes small changes to a large number of pages throughout the sites directory structure - so the files don't overlap, but the directories overlap quite a bit. I think cherry-picking changes for him would be very tedious since he would have to merge one changeset at a time whenever another user has a change set between his changesets (i.e. when he can't select a series of his own changesets). Thanks for your response.
JacksonD