tags:

views:

140

answers:

2

I have moved from subversion to tfs for version control, and it is my understanding that you cannot merge discontinuous change-sets in tfs.

For example, say I have a file baseline.txt that looks like this:

line one

Then, I branch the file to a new file called branch.txt, and then do two check-ins on baseline.txt so that it finally looks like this:

line one
line two //checked-in change-set A
line three //checked in change-set B

Now, I want to merge only change-set B into branch.txt. In other words, I expect branch.txt to look like this after the merge:

line one
line three //checked in change-set B

Basically, I want to skip change-set A and merge change-set B. It is possible in subversion, but in tfs if I want to get changeset-B, I have to also get all change-sets up-to B. Is this true? That's what my experiments show, but this article seems to indicate differently.

A: 

That article is confusing, and I don't believe it is accurate. When the second change is checked in, it should generate a merge conflict. At that time, you would need to resolve the conflict in one of three ways:

  1. Merge the changes
  2. Overwrite with the new changeset, or
  3. Keep the old, and discard the new changes.

No matter what, when you get ready to merge back to baseline.txt, you have a "point-in-time" version of the file that you're going to check in.

Robaticus
Robaticus, there would be no conflicts generated in this sequence of check-ins. The only potential for conflict would be if a change occurred after the branch.txt where created and before the merge of Changeset B was applied.
Ryan Cromwell
I assumed that checkin 1 and checkin 2 were being made from two separate machines. IN that case, there would be a merge conflict that would need to be addressed. I can't envision a scenario where both changes could be made from the same machine.
Robaticus
The other conflict would be the actual merge itself when selecting the version of Baseline.txt associated with Changeset B. Reading this a second time I think that is the conflict to which you are referring. The 3 changsets (initial add, line 2, and line 3) used to create the baseline.txt would not include conflict resolution.
Ryan Cromwell
Even if they are made fom two seperate machines/workspaces, the second checkin (line 3) would need to be done without a get latest on baseline.txt after line 2 was added. While this is certainly a possibility it is not assumed or manditory.
Ryan Cromwell
In the end though, your point that the merged item will demand a resolution of the missing line in branch.txt is correct and (currently) unavoidable.
Ryan Cromwell
@Robaticus - While I understand your answer, it was not really my question. I assumed the change-set B is checked-in sequentially after change-set A is checked in (even by the same developer, if you like). I am *also* not concerned about merging changes back from branch.txt to baseline.txt. What I want to know is if there are multiple check-ins (say there were 10 check-ins = 10 change-sets) on baseline.txt after it was branched to branch.txt, and I only want to selectively merge some of the change-sets (e.g., skip 1-3 change-sets, and merge 4-10), is it possible?
Raghu Dodda
@Raghu - Nothing I've seen in TFS indicates that what you want to do is possible with the standard tools. If you instead had 10 separate branches, you could merge selectively from each of the branches, but as far as changesets are concerned, I doubt that will work.
Robaticus
A: 

Not sure, but this question about baseless merges might have the answer you are looking for.

Zachary Yates