How to Re-Merge after Rollback of Previous Merge - visual-studio

We're using Visual Studio 2015.
I have three branches, 'DEV' where new code is made, 'MAIN', where tested good code goes as the primary repository, and 'PRE' where edits are made to previously released code. (PRE changes can be merged into DEV easily since we should never be working on the same file in two places)
That said, I merged good code from PRE to MAIN with no issues. I checked in those changes. When I merged that code from MAIN to DEV, there was conflict in the .sln file, but this is nothing new. Some new projects exist in DEV that don't yet exist in MAIN or PRE, so there's always some shuffling. I used the merge tool and attempted to resolve the conflict.
I completed the merge, and checked in the changeset. Only after check in do I realize there was a problem in the merge of the .sln file and I cannot build the solution because the paths for the files got crossed/corrupted somehow.
The error I receive is 'Metadata file \path\folders\buildlocation\solution.dll could not be found'. This error is repeated for every project. EDIT: I solved the problem with the build. It was not a .sln problem, but an error in the shared library.
===========================
That said, I believe the question below is still valid, if someone should ever need it.
So here's the question: I know I can do a rollback on DEV to get back to the previous state, but this creates 'new' changes which need to be checked in, which will overwrite the previous change. However, once that's done, I will still need to attempt to re-merge the good changes from MAIN back into DEV. Since that changeset is already merged, it is no longer available as a merge candidate.
How can I A) Rollback checked in changes from a merge in DEV and then B) Re-merge those changes into DEV and attempt to do it correctly?

Related

TFS - How to carry on working on file which has pending check in changes?

I have shelved my changes in TFS which will be checked in few days time. Now i want to work on different TFS card which belongs to same file. How can i work on the same file when its changes are not checked in yet ?
How can i work on the same file when its changes are not checked in yet ?
You should use Branch. You can create a new branch based on file are not checked in, then you work on different TFS card with previous branch, after that, you can check out the new branch to work on the same file when its changes are not checked in.
Shelvesets are per-user and differently stored in the source control - it is not possible to merge shelvesets, there's no history etc. The only action possible is unshelving; you cannot even merge files while doing so. So, we only use it as a temporary storage for things that are not finished yet and thus cannot be checked into a branch.
So, you should use branches. Maybe a Main branch and different development branches for features & bug fix.
Hope this helps.

TFS - Make a child branch the main branch and abandon original parent

Somehow, my Visual Studio project got very much messed up. The source code was good, but things were messed up in some of the configuration files. After hours of fighting with it, I found an earlier changeset (changeset 20) that compiled and ran fine, albeit without the latest changes (I was up to changeset 25 by now).
I then performed the following steps:
I retrieved a copy of changeset 20 into a new temporary workspace.
I used WinMerge to manually merge the latest source code changes into the changeset 20 code that was in my temp workspace.
I branched my main branch (called MainBranch) in TFS to a new branch called TempBranch.
I manually copied my merged files (from step 2) from the temp workspace into the main workspace for TempBranch.
I checked the merged code into TempBranch.
My Heirarchy looks like this now:
So, now, TempBranch has all the latest "good" code, and none of the corrupt configuration files. MainBranch has the bad configuration files.
So now that TempBranch is exactly how I want it, and it's what I want to base all further development on, what should I do at this point, so that MainBranch is basically identical to TempBranch?
I'm worried that if I try to merge the branches, it will try to merge the bad config files in MainBranch with the good ones in TempBranch. I want to make sure that for all differences in the two branches, the TempBranch version "wins".
You can try to merge from TempBranch to MainBranch, and take source branch if there are conflicts.
If the history is not important in MainBranch, you can reparent the TempBranch, and choose No parent. Then there is no hierarchy between TempBranch and MainBranch, you can work on TempBranch.

When merging changes in the MSVS2013 IDE, is there a log of what occurred?

I pressed Alt-E which I mistakenly thought was Merge Changes In Merge Tool, however, that was actually Keep Local Version. Is there a way to go back? Is there a way to find out what was merged, as in what file? Ugh! :(
I have completely stopped working in case I erase something of importance.
I'm using MSVS 2013 Professional.
Here's another possible approach.
If you know what version of the code you started with before you started making your current batch of changes, you can grab a copy of your local workspace files. Then Undo all your Pending Changes. Then delete all the files in your local workspace (in Windows explorer). Then do a Get Specific Version to get back the old version of the files from where you started, then copy-paste in your updated files from your backup copy. Then do a Get Latest. This should retrigger the Merge process.
I don't know a great answer to this problem, but I do know one thing you can do (I hope you don't have a massive amount of pending changes, or this will get tedious).
The problem is that TFS thinks you have now merged the server changes (other devs changes) into your workspace, even though you told it to basically toss them. If you try to check-in now it will blow away other developers changes in TFS.
What you can do is go through each file in your pending changes window, and do a Compare With Latest Version. This will show you the differences between your local file, and the file in TFS. You will notice two types of differences:
the changes you made which you can just skip past.
Changes that other devs made and are on the server, these differences will show up as though you have deleted/undone that code locally
For the changes that other devs made, you will have to manually reapply them in your local workspace before you check-in.

Team Foundation Server error

I have done some work on a VS 2010 project which is under TFS. I have created a shleveset and want to unshelve the shelveset on another system. But I am getting following error:
---------------------------
Microsoft Visual Studio
---------------------------
Multiple errors occurred during the operation, the first of which is displayed below. A full error list is available in the Output Window.
TF203015: The item $/ConsumerCredit/project1/project1.Database/project1.Database.dbproj has an incompatible pending change.
---------------------------
OK
How can I fix it
Some guesses:
Look at your list of pending changes. You may already have opened this file for delete or rename or something like that. You can't get the file out of the shelveset because you opened it in the shelveset for something different such as for 'edit'.
You'll probably have to undo your pending change on this file and then get the shelveset.
Or possibly you locked the file when you checked it out on one system, so you can't start editing on the other system (getting it out of the shelveset would adding to your pending files for edit). You could undo the checkout of the file on your first system.
This is a slight aside to the OP's question
You can get a TF203015 when you try and batch merge a multiple changesets from one branch to the other without due care.
Consider a situation where you have a MAIN trunk and a DEV branch. You branched DEV from MAIN and have dillegently worked away at a feature in DEV; checking work back into DEV as you progressed. Now fast forward a week or two. You are now feature complete and want to merge back into MAIN.
This is where one of our devs hit this error.
He had been woking on one solution for weeks, and checking changesets back into DEV periodically, so wanted to merge a non contiguous series of changesets back into MAIN.
So he picks the merge option, selects the first changeset; merges withoout issue, then immediatley went to merge the next changeset; and bang TF203015, and its very unhelpfull test in teh output window; incompatible pending changes.
After a little fiddling around we now realise what is going on here; the first merge created a pending change in MAIN for the developers solution. The next merge attempt was also changes to the same solution, which would require TFS to "queue up" a second set of pending changes to the same files. It cant do this.
So in this scenario TF203015 means; "The destination branch already has pending changes on some files that are changed in this changeset. Please resolve and commit the destination branch changes before perfoming this merge operation"
The solution; after each merge operation our developer tests the workspace for MAIN and commits the pending change caused by the merge, then goes back to DEV and repeats.
Actually sensible and simple, but masked by a very obtuse error message.

TF203015 The Item $/path/file has an incompatible pending change. While trying to unshelve

I'm using Visual Studio 2010 Pro against Team Server 2010 and I had my project opened (apparently) as a solution from the repo, but I should've opened it as "web site". I found this out during compile, so I went to shelve my new changes and deleted the project from my local disk, then opened the project again from source (this time as web site) and now I can't unshelve my files.
Is there any way to work around this? Did I blow something up? Do I need to do maintenance at the server?
I found this question on SO #2332685 but I don't know what cache files he's talking about (I'm on XP :\ )
EDIT: Found this link after posting the question, sorry for the delay in researching, still didn't fix my problem
Of course I can't find an error code for TF203015 anywhere, so no resolution either (hence my inclusion of the number in the title, yeah?)
EDIT:
I should probably mention that these files were never checked in in the first place. Does that matter? Can you shelve an unchecked item? Is that what I did wrong?
EDIT:
WHAP - FOUND IT!!! Use "Undo" on the items that don't exist because they show up in pending changes as checkins.
I had deleted the files in trying to reload the workspace, even though I had shelved the changes. Then VS2010 thought those files were still pending to save. I didn't need that, so I had to figure out to "undo" the changes in Pending Changes.
Then I could unshelve.
It thought I had two ops (unshelve, commit-for-add) going simultaneously, and I thought I had only one op (unshelve).
This is a slight aside to the OP's question
You can get a TF203015 when you try and batch merge a multiple changesets from one branch to the other without due care.
Consider a situation where you have a MAIN trunk and a DEV branch. You branched DEV from MAIN and have diligently worked away at a feature in DEV; checking work back into DEV as you progressed. Now fast forward a week or two. You are now feature complete and want to merge back into MAIN.
This is where one of our devs hit this error.
He had been working on one solution for weeks, and checking changesets back into DEV periodically, so wanted to merge a non contiguous series of changesets back into MAIN.
So he picks the merge option, selects the first changeset; merges without issue, then immediately went to merge the next changeset; and bang TF203015, and its very unhelpful test in the output window; incompatible pending changes.
After a little fiddling around we now realize what is going on here; the first merge created a pending change in MAIN for the developers solution. The next merge attempt was also changes to the same solution, which would require TFS to "queue up" a second set of pending changes to the same files. It cant do this.
So in this scenario TF203015 means; "The destination branch already has pending changes on some files that are changed in this changeset. Please resolve and commit the destination branch changes before performing this merge operation"
The solution; after each merge operation our developer tests the workspace for MAIN and commits the pending change caused by the merge, then goes back to DEV and repeats.
Actually sensible and simple, but masked by a very obtuse error message.
You can use the Team Foundation Server Power Tools March 2011 (http://msdn.microsoft.com/en-us/vstudio/bb980963.aspx) that includes the command tfpt unshelve.
Once the Power Tools are installed, open a Visual Studio command prompt, change to the directory that contains the project of interest, and execute the tfpt unshelve command. It will unshelve and display the merge dialog so you can resolve the conflicts.
I credit this blog post with helping me find this solution: http://fluentbytes.com/the-how-and-why-behind-tf203015-file-has-an-incompatible-change-while-unshelving-a-shelve-set
I had what appeared to be the same issue but I had created a branch after shelving my changes and I wanted to unshelve those changes to the new branch.
TFS cannot unshelve to a different path than the path upon which the shelf was created.
Solution: I unshelved back to the original branch then I used beyond compare to merge the changes from my original branch to the new branch and checked in.
It could also be that after you create a folder in say a "Test" and you want to merge from dev to test, that you do not have that newly created folder structure checked into TFS - You will /can also get this error message.
Thus this message error CAN occur without anything to do with SHELVESETS as well for others coming from google and finding this page.
This might be the same as jcolebrand's answer, but I'm afraid I found the phrasing there a bit abstruse. Sincere apologies if I'm just repeating.
In my scenario the incompatible pending change message was presented because I was trying to roll back multiple changesets, and the same file was affected by more than one of those changeset.
In my case I did not want to commit until all the changes had been rolled back. I believe if I had been able to commit after rolling back each changeset, the error would not have happened.
The method which worked for me was as follows:
I opted to roll back one changeset at a time. I found using the command line was actually a more informative way of doing this because it lists all the conflicts, whereas I think the VS UI rollback just lists the first.
While rolling back a changeset, if there was an incompatible pending change, I had to undo my workspace's pending changes for the affected files.
When all the changesets had been rolled back, I had to manually revert the files which had experienced incompatible pending change. Mostly this could be achieved simply by getting a specific version of the file (the "last-known-good" version before all the bad checkins started). But for some files where there had been both desired changes and undesired changes, I got the "last-known-good" and manually applied the good changes to it.
This link resolved my issue:
https://blogs.infosupport.com/the-how-and-why-behind-tf203015-lt-file-gt-has-an-incompatible-change-while-unshelving-a-shelve-set/
The reason was pending change in the same work space create an incompatible change. So undo the pending changes and try unshelve. This should resolve the issue.
If you have two branches MAIN(target) and DEV(source), now you want merge DEV into MAIN, then all files you want merge from your source, must not be older then the similar files in your target branch.
For example: you have an changed file test.cs in your DEV branch, changed at 14.03.2016. In your MAIN branch you have test.cs changed at 15.03.2016. So the target is newer then the source file and you have TF203015.
Solution: navigate in TFS Explorer to the conflict-file and merge it explicit. TFS will open the conflict manager and you can merge the conflicts by hand. Following you can merge the selected changeset.
Remarks: If you have more conflicts, you must navigate to each conflict-file and merge it explicit, so TFS opens the the conflict Manager and you can merge it by hand.

Resources