TFS Check which files have been manually merged - tfs

A merge has been completed in a local workspace. I'm interested to see which files were manually merged (ie which ones initially came up in the resolve conflicts window).
Is there any way to find this out now that all conflicts have been resolved?

Shelve the merge and undo local changes. Then merge again and record the list of conflicts that cannot be automatically resolved.
This is the slow and painful answer. I sincerely hope there is a better way so I can delete this and not have to sit through a tonne of progress bars.

Related

Changesets candidates for merging showing up over and over again

I have a main line called "Main" and a "Dev" line. Dev is child of Main.
Main
^
|
Dev
Actually, Main is used as a normal Dev branch, so both are checked-in new work continuously.
From time to time, we decide to merge both. Pull Dev changesets to Main and the other way around. I guess we've not doing this correctly. We change files during merges, etc. In one situation we have created a branch from Dev to stabilize. Guess this was a mistake.
The problem is, some changesets are "persistents", they keep showing up in merge window, also in "tf merge /candidate" command, as if they weren't merged already.
I guess I could do a tf /discard and that would make the changeset disappear. Shouldn't it be this way?
What is more, sometimes a merge reappers or even disappers after merging another changeset. Guess it is a somehow related changeset from another merge operation. In the course of getting rid of these, one single changeset is merged more than once.
PS: Have tried tf /discard, tf /discard /baseless, tf /baseless handling conflicts. Nothing works. Did not try /force because I'm not keen on redoing all conflicts AFAIK.
It looks to ne like you are suffering from the pick-n-mix anti pattern.
http://nakedalm.com/avoid-pick-n-mix-branching-anti-pattern/
Change your branching method and the issue will go away.
Since I could not merge in the reverse direction (as mentioned in another solution), I tried to solve this in another way.
I rolled back the merge, checked in, and merged again. This time, trying to make no invasive changes.
I did have to 'change' the project file, since the merge tool listed a single chunk of lines that I needed to merge partially. So I excluded the chunk but manually copied the lines that I did need, still inside VS's merge tool, during conflict resolution. Then I accepted the resolution.
During my first attempt, I had left out these lines completely, causing some files and folders to be wrongfully excluded from the project. Then, in the Solution Explorer, I had re-included those files and folders.
Somehow it seems that my first attempt caused TFS to see the merge as incomplete, leaving it in the list. My second attempt was seen as a complete merge and successfully swallowed the candidate.
You shouldn't need to discard changesets. If you want to "sync" them, just merge MAIN->DEV, then DEV->MAIN, potentially resolving conflicts at both steps.
After that no changesets should show up in the merge list and they should be in sync. If this isn't happening for you, we need some kind of reproducible scenario or detailed description of a specific scenario so we can help you out.

TFS Merging keeps merging some files without any changes

For some unknown reason, TFS seems to keep queuing certain files for merges, even though there are no changes. In the Pending Changes windows, the Change column only states Merge, and not the usual Merge, edit or Merge, branch.
Nobody touches these files and yet they keep reappearing under the pending changes merge queue.
I've seen this happen before with a folder that was deleted, but kept reappearing in the merges between branches. In that case, I used tf destroy in all branches for that folder's path and it solved the problem. However, in this environment, it's with files that the team wants to keep.
Has anyone else experienced and/or resolved this issue?
Try TFS 2010 SP1 and CU1. It fixed some merge bugs. Like the following:
Merge or discard in both directions cause unnecessary "empty" merges
in future merge attempts.
If you have the Team Foundation Power Tools installed you can use tfpt uu to undo changes to any unchanged files (yes, it's well annoying when files are flagged as changed and you get told they are identical!).

TFS merge changeset into file with pending change

I have a feeling this is a very stupid question, but I can't find the answer anywhere.
So we have a Dev branch and a QA branch. I merge a bunch of contiguous changesets from Dev into QA, and resolve conflicts. Now I want to merge in a later changeset, over the changes I just merged (not having checked in the changes from the first merge). No dice, says TFS:
The item $/My/Path/to/the/file.vb has an incompatible pending change.
What's its problem? Why won't it give me a merge conflict option to merge the new changeset to the files with the pending changes? I don't want to check in the first merge just so I can merge in another changeset.
TFS doesn't allow you to merge multiple non-contiguous changesets if the same file is changed in both of them. Your best option is to checkin the first set of changes, then do the merge.
I had the same problem. I did undo all the pending local changes and un-shelved the pending changes. It fixed my problems.
I was experiencing this same issue for a different reason and since I stumbled here for help I will give my solution.
I had a branch (branched_from_main) that was branched from main. I made changes to branched_from_main and checked them into the tfs repo. Then when I tried to merge branched_from_main back to main I was experiencing this issue. After looking into it for a while I realized that I had opened the main solution and built it. This meant that the solution now pulled down all of the nuget packages. Thus my main branch was considering the packages as pending changes.
So to fix the issue I had to reopen the main solution and undo those pending changes. Then I was able to merge branched_from_main back to main.
It is enough to check-in the folder that you are going to branch to.
In my case I created a new folder in my target branch and it was on the "Add" state (without check-in) and I had this same problem. After I checked in this folder it worked well.

How does merging work in TFS 2010?

When I merge files from one branch to another and then go to check in files into the target branch, there are MANY files checked out, just the ones that changed. For example, Main and Critical branches were the same and we made changes to only 2 or 3 files on the Critical Fix branch. I then merged Critical ==> Main, and when I went to check in changes to the Main branch I noticed that there were numerous files checked out, not just the 2 or 3 that were actually changed in the Critical Fix branch. Moreover, when I compare a file from the Main branch to one on the server, I am told that the files are identical. If the files are identical, why are they checked out? Any help would be appreciated, or even a link that explains how TFS 2010 does merges.
The default Source Control Merging tools in Visual Source Safe and then TFS have always been rather poor - they are often confused by the simplest changes, often detect identical files as being "changed", and the auto-merge facility frequenty fails (includes the wrong changes). I quickly learned distrust for these merge tools (in about 1995) and have not seen any evidence in any of the new releases since then that the core merge algorithms have been improved at all.
The good news is that you can replace the client-side merging tools with third party ones (I use one that works so well that I actually trust its auto-merge option. I once spent 2 days trying (and failing) to do a complex merge with the TFS tools and in the end bought this 3rd party tool and re-did the entire merge successfully in 15 minutes!)
The bad news is that the first step of branch merging just uses the TFS merge code, and so it gets confused a lot, resulting in the symptoms you've described. This is frustrating in such a key feature of such an expensive application as it wastes a lot of programmer time on every merge to fix imaginary "conflicts" - on the plus side, with the help of 3rd party tools it is usually very easy to reliably resolve these merge issues.
I have had the same problem. I created a branch of our DEV branch and made changes to a few files. I checked in my changes and merged the latest changes to DEV into my branch. After the merge all 30,000+ files in my branch were marked as changed. Just like cju, I found that a comparison of most of the files showed that no changes had been made.
I decided to undo all changes and try again. When I right-clicked on the solution and selected Undo, I got a message that one file had changes, was I sure I wanted to undo that file? I clicked "No to All" and when the undo operation was complete, only the files that had been changed during my merge from DEV were still checked out. This was exactly what I wanted so I checked those changes into my branch and continued working.
I hope others can correct their situation as easily as I was able to.
One thing I noticed is that when one file is changed in different branches resulting in exactly the same content, then merging marks it as a conflict since the file is changed in both places. Of course a difference view of the file notices that there are no changes and therefore an auto merge solves this automatically for you.

What to do with a branch after the merge with TFS

After merging a branch back to the "trunk" what do most people do with the branch. Just delete it? Move it to another area? Change it's permissions?
The concern we have is that developers who are away, and don't read their mail could come to work and continue working on the branch, after the merge has been done.
Once the branch is definitely dead then I like to delete them. You can always undelete something in TFS if necessary (Options, Source Control, Show Deleted Items). Dev's working in that area without realizing it may get some strange behaviour (i.e. files dissapearing when they do a Get Latest) however it get's them to figure out something has happened pretty quickly.
That said, sometimes it can take a while to ensure that the branch is definitely deceased in which case changing the permissions on the branch so that only a limited number of people can edit the files on that branch is a handy technique. You can have one person lock all the files in the branch with a check-out lock but I've not found that to work too well when freezing a branch - permissions seems to work better so that you do not have to have a bunch of pending changes (the locks) to manage for all the files in the branch and also you can have more than one person working on it while it is being frozen.
We delete branches, once we're sure the merge was successful.
We move them to an Archive folder. We should probbaly change permissions as well.

Resources