0

I moved from Subversion to Microsoft's Team Foundation Server for version control, and it is my understanding that you cannot merge discontinuous change-sets in TFS.

For example, I have a file called "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 "Understanding ChangeSets and Merge with Team Foundation Server" seems to indicate differently.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Raghu Dodda
  • 1,505
  • 1
  • 21
  • 28
  • Not sure, but [this question about baseless merges](http://stackoverflow.com/questions/1437304/tfs-baseless-merge-on-specific-changesets) might have the answer you are looking for. – Zachary Yates Sep 13 '10 at 18:25

1 Answers1

0

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
  • 22,857
  • 5
  • 54
  • 63
  • 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 Jul 06 '10 at 14:43
  • 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 Jul 06 '10 at 15:14
  • 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 Jul 06 '10 at 15:21
  • 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 Jul 06 '10 at 15:23
  • 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 Jul 06 '10 at 15:24
  • @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 Jul 07 '10 at 00:15
  • 1
    @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 Jul 07 '10 at 14:05