-->

TFS Merge: Cannot discard a changeset

2019-05-26 18:25发布

问题:

We have a changeset where the developer has checked in changes to both source and target branch, many changes including renames in both branches. The merge of the the changeset from source to target branch goes fine, but the changeset remains in the list of changesets to be merged.

When I now try to merge the changeset again, it says "There are noe changes to merge.". And the changeset remains in the queue.

We have tried to use the command line tool to discard the changeset like this:

C:\src\project\sourceBranch>tf merge /discard /recursive /version:C8137~C8137 $/Project/sourceBranch $/ Project/targetBranch

This did not help. We have also tried using other options like /force and /baseless with no luck.

What other possibilities are there of getting rid of the changeset among the merge candidates?

回答1:

Ok, so basically you have a changeset with items that belong to two branches that are directly related. Which makes the merge of such changeset using the "partial changeset" subcomponent of the changeset.

Let me explain with a better way:

  • CS1234 (your changeset)
    • Partial CS1234A for branch A (say the source branch)
    • Partial CS1234B for branch B (say the target)

You did a merge from A to B, which merged CS1234A to B.

Now when you attempt a new merge still from A to B, you still have CS1234 as a candidate, right ? Then if you select it, nothing is done, which is totally understandable due to the fact you already merged CS1234A and CS1234B does not belong to the source branch (A).

Looks like a bug from TFS to me that I already ran into, I thought Microsoft fixed it with the TFS 2010 RTM, apparently not.

Basically TFS gives you CS1234 as a candidate because only a partial part of it was merged, but as the other partial part can't be merge, it doesn't make sense to give it as a candidate.

What about:

You initiate a merge from B to A (in the reverse way), does CS1234 is given as a candidate ? My assumption is if you merge CS1234 from B to A then you won't be bother again with this changeset when you'll display the candidates from A to B. But I don't know if it's something you're willing to do.

Anyway you should fill a bug at the Microsoft Connect site