Visual Studio/TFS: How to Remove Rollback From Pending Changes? - visual-studio-2005

I would like to ask how can I undo a rollback that I have in my "pending changes"?
Example:
In my pending changes I have many updates
Next I went to history and did a rolledback for one changeset from 2 weeks ago.
In Team Explorer I see: [FileXYZ.cs][edit, rollback]
FileXYZ.cs contains other changes that are not related to the rollback
Now I want to "undo" rollback as if I have never wanted to do it. In other words I want that the rollback does not take place when I check in the pending changes. However I want that the changes in this file that were not related to the rollback are checked in.
I do not want to do simply "undo" on a file as I will loose other changes. I want to undo rollback for this particular changeset.
Any advice,
Learner.For.Ever

First, the file should be changed to reflect the rollback, so you may need to check that you do made the rollback successfully.
Second, there isn't anyway to undo the rollback in your case since you didn't check in the pending changes before you roll back and VS does not record these information either. So even the changes for the rollback is known, there isn't any information recorded about the changes you made before roll back, so it cannot be restored.

Related

Visual Studio - TFS Rollback is grouping subsequent changes

We have a changeset that didn't make the cut and I would like to roll it back.
The problem is that we have another developer that touched the same file whose changes we would like to keep but checked in after the first changeset (2nd dev got latest w/ bad changes, added their portion then checked in). When I go to perform the rollback on the earlier changeset, it is including the subsequent changes from the later changeset in the rollback.
Has anyone else experienced this behavior? Why are these changesets not completely separate and how do I rollback just the changes of the earlier changeset while keeping the later changesets?
I can manually parse together the files in the merge tool but I feel like I shouldn't have to. Why isn't it just identifying the lines of the bad check-in and removing them?
After a rollback, you can confirm the changes that result from rolling back some items match what you intend to do before you commit them to the server. As the developer modify the same file, the latter changeset will also be reset. If you change different files, the latter changeset will be reserved.
You need to do modification on the latter changset and remove the early changes.

Shelving and then Undo pending changes

I'm new at TFS in Visual Studio and I want to understand something about Shelve and Undo.
Let guess I checked out some files, made some changes and then shelved them.
In that moment - the source code which was before I made changes is restore to original code so all the team members won't see my changes?
-- or --
they see the modified code until I Undo pending changes?
And if I undo the changes - will it affect my shelvset?
So you need to understand what is actually happening. When you make changes, they only exists on your machine until you check them in to the repository.
A shelveset provides a "safe" place for you to store your changes before you check them in.
The rest of the team won't see your changes until you check them in to the repository. So when you undo changes it is merely the changes that you made to your code that is on your machine.
In your example above, your team won't see any changes until you actually check it in.
Changes in Shelvesets can be seen by the other team members, but they are not committed to the repository. They would have to go to Pending Changes -> Actions -> Find Shelveset and type you name in the user search box.
Only when you do a check-in, will others see your changes in the repository.
Undo will remove the changes locally, but the shelveset will remain so that you or anyone on the team can get the changes back locally.

Can I recover my recent local changes after initiating a rollback in TFS 2013?

In VS/TFS 2013, in the History screen, when you right click a changeset and select "Rollback Entire Changeset", TFS immediately clobbers all your recent local changes, and attempts to merge where it has merge conflicts. Deleting files, undoing work.
I made this mistake just now, and I'm looking for a solution that allows me to undo the rollback operation.
Note that I haven't committed anything yet. However TFS has already deleted local files and undone work, and saved those changes to disk.
In the Merge screen, I was able to select "Undo Rollback" for any file that had merge conflicts. But for those files that didn't have merge conflicts, they were automatically resolved, and I don't have the option of undoing the rollback.
Is there a way to cancel the rest of this rollback operation without undoing all my local changes?
Is there a way to revert files that were Auto Resolved by the rollback merging into the local changes?
Is there a place on my hard drive where TFS stores the previous version(s) of files it's about to commit?
Next time, I'll remember to make a shelveset before attempting a rollback. This sucks.
Thank you.
No, there is no easy to undo the local uncommitted changes 😩.
I always do rollback and branch operations in a separate workspace to avoid conflict.

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