Tuesday, 18 June 2013

TFS 2012 - Invalid Changesets appearing in the list of merges

I encountered this problem of getting unnecessary changesets in the merge list after branching using TFS 2012, so thought to blog about it.

I took a branch out of our main development branch, using the option "latest version". Immediately after the branch had been taken, I attempted to merge from the source branch to the newly created branch with the option of "selected changesets to merge". 

Since, nothing had been checked-in in the source branch, you would expect that the list is empty. However, I could see quite a few pending changes in there. Confused and somewhat unsure of what happened there, I did a folder comparison between the source and target branches and the files were in fact the same, so no concerns as far as branching goes.

This is actually a known issue in TFS 2012 and has been fixed in TFS 2012 Update 2. The issue was that if the source branch contains a file such that the file has had a case only rename (e.g. it has been changed from file.txt to File.txt), any changesets containing that particular file will still be shown in the list of pending merges.

As, I said the issue has been fixed in TFS 2012 Update 2, so your solution is to upgrade to TFS 2012 Update 2.


Geração Esperta said...

Hamid Shahid,

In my company we have VS2012 update 4 and this bug still happens.
Could you help me solve this problem?

My contact: marcusbrisolara@hotmail.com

Hamid said...

Are you sure it is the same bug. In my case, the only changesets that appeared were the ones in which the casing of a file name was changed in the source branch. For instance (a.txt was changed to A.txt).

After upgrading to Update 2 and now at Update 4, these are not appearing.

Geração Esperta said...

So Hamid, when I change just one file, like in your example, this bug doesn't occur in update 4, but, when I have many changes in many files and try to merge a root of my project, this bug still occur.

You have an idea about what's happening?

Hamid said...

t's a different defect than I am afraid.

You can discard the changesets so that that they don't appear again using the following commad

tf merge /recursive /discard $srcbranch;1~100 $/tgtbranch

where 100 is the last spurious candidate chagneset

Torbjörn Kalin said...

Thanks for the help.

This only seems to fix the problem for new branches. Branches created before applying the patch still has the problem.