Visual Studio loses track of pending changes after unshelve - tfs

Yesterday I worked on a set of changes I don't want to check in yet, and at the end of the day, decided to shelve my changes. The changes included a bunch of added files. The shelving worked fine, but today when I unshelved, the following happened:
VS told me four writable files already exist in my workspace. These files were the ones I added
I told VS it's all good, overwrite them and we're set
VS finished the unshelve...
... but left the "pending changes" tab empty.
I figured maybe something went wrong and re-tried the unshelve. At this point VS proceeded to tell me I've got pending changes in my workspace. So now I can't check in, can't unshelve and apparently the files are locked for edit under my name (yes, we use the lock-modify-unlock mode, unfortunately). What gives, and how do I fix it?
Edit: Upon further inspection, Source Control Explorer doesn't show pending changes from me, so apparently it's just my workspace that's borked. Correction: yes, it does, I was just looking at the wrong branch, aargh!
Edit 2: tf.exe does show the changes. I tried to undo them, delete the files that were still in the workspace (the ones that caused first VS error) and unshelved without errors. For a short while VS displayed the pending changes, but when the operation completed, they all disappeared.

OK, I'm just full of stupid today. The shelveset I was working with didn't belong to the branch I had open. Opening the project from the correct branch miraculously shows the changes in the pending changes tab!

Related

How to partially undo a TFS checkin across multiple solutions

A while ago, I accidentally checked in some unfinished unittest files I had changed and added in solution A together with some files that contained an actual bugfix for project B.
For some unknown reason I never noticed the checkin was going to include files from another solution so the checkin was done, after which other team members added more checkins to both solutions.
My question now is two-fold;
How can I undo the part of the checkin that hit solution A without affecting B at all
Is there a way to prevent mistakes like this from ever being possible to happen within Visual Studio (Enterprise 2015), make it impossible to checkin files not part of the currently opened solution somehow?
I think the easiest solution would be to use the ROLLBACK command, if you have installed the TFS power tools (TFPT) you should be able to do it within visual studio.
In your current branch, get the latest version from server then view history and find your changeset. Then right click and select "Rollback entire change set".
This will rollback the changes in your local workspace and checkout the file. (If there are conflicting changes you will have to resolve conflicts.)
Now when you are ready to check-in, exclude/undo the files which you don't want to rollback.
Commit/checkin the files which you want to rollback.
I haven't seen a better way of doing this, and think that this is much better than individually rolling back each file in the change set.
Now to answer your second question: check this ANSWER which I wrote a while back. I am copying it here for convenience.
As far as I tested, this default setting is controlled by the following registry entry. If the value of this registry entry is set as 1, then it should change the default behavior to filter by "Solution Changes".
"HKCU\Software\Microsoft\VisualStudio\12.0\TeamFoundation\SourceControl"
Name: FilterPendingChanges
REG_DWORD
Value: 1 = Show Solution Changes
Value: 0 = Show All

Unable to resolve pending changes after renaming a folder

I renamed a folder correctly in Visual Studio (shows as a move) but after merging down to the parent branch, I've now got numerous conflicts that I'm unable to resolve.
They show up in the 'Resolve Conflicts' window with the Description, 'You have a conflicting pending change.' against each conflict.
If I try to resolve by taking the server or the local version, they disappear but reappear seconds later.
I've tried tf undo * /recursive from the parent folder but that reports 'no pending changes to undo' and I've tried delete the entire folder and 'Get Specific Version..' and forced over-write but nothing I do can get rid of these conflicts.
I ended up deleting the workspace and re-getting the latest code before trying the merge again, and everything worked fine. I'm guessing there was some sort of corruption in the workspace.
This worked for me:
1. Exit Visual Studio
2. Open a command window and navigate to the folder: "%localappdata%\Microsoft\Team Foundation\"
3. Navigate to the sub folders for every version and delete the sub folder "cache" and its contents
4. Restart Visual Studio and connect to TFS.
5. Undo/Get Latest Version.
Try undoing any dependent changes first, retrace your steps that you did in the merge. Don't try to undo all changes at once. It's likely there are dependent changes that need to be undone before you can undo the one in question.
e.g. If you have renamed/deleted files or a folder then undoing the rename may cause a clash with some other folder or files, so undo the merge of those dependent files/solders first, then try undoing the renamed/deleted ones.
I have found that if you try to do rename, edit and merge in one go it will get confused and when you go to undo it there will be conflicts unless you undo the conflicting changes first.

How do i remove files from the Pending Changes list in TFS when those files weren't in the source yet and have been deleted locally

Someone added a workspace incorrectly, so after I fixed it TFS thought I had added some files to the project (dll, pdb, and xmls). So I tried just deleting the files and refreshing the pending changes. I tried clicking undo, but the Output window says
No pending changes were found for
$/SourceCode/Apps/.../Lib.dll.
(I replaced part of the full path here).
So the undo won't do anything.
I tried "Refresh Status" under File-> Source Control after every step.
I tried re-adding these files and then doing the undo.
So for example I am stuck with
Name Change
UI.xml add, lock
Design.dll add, lock
and can't remove them.
Any suggestions are appreciated.
Thanks!
Don't delete. Once you "add" them to TFS, it creates an entry in the database just waiting for the files. Instead, undo your "add."
That's actually how to fix this problem as well.
Right click on any source file in the source explorer, and choose Undo Pending Changes. Uncheck everything except for the two files that you need to get rid of the add. Click OK to undo those changes.
That will clean up everything in the TFS database.

TFS shows some pending changes under my name, but I have not changed anything

TFS shows some pending changes under my name, but I have not changed anything. When I check in and see View Pending changes, I see some of the changes which I have never made, changes pending under some other user might be shown as my pending changes. When I unselect and check-in my changes, these are still locked under my name? Is this due to auto-checkout or any other reason? (TFS policy requires a compile before check-in)
This is probably due to the automatic checkout feature in TFS.
TFS uses an atomic check-in process and is very careful about recording who did what. When you start editing a file (or the IDE edits one on your behalf, for example a .csproj or .vbproj file) then the file will show up in your pending changes list to show you that you have the file checked out with an edit pending.
To see your pending changes list, go to View, Other Windows, Pending Changes in Visual Studio.
To check-in any pending changes you can right click on the file in solution explorer or you can select it in the pending changes view. Only then will the change be committed into version control. From the pending changes view you can compare with the server version to see what changes you have made.
To see the changes that have been committed to the server you can right click on a file or folder and select "View History".
If you want to remove the pending change and restore the file to what it was before you edited it you can right click on the file and select "Undo Pending Changes".
If you want to change the auto check-out behaviour to prompt you before it performs a check-out, then go to Tools, Options, Source Control, Environment and change the Checked-in items for Saving and Editing to "Prompt for check out" rather than the default which is "Check out automatically".
Hope that helps,
Martin.
I've had a similar issue; TFS still says I've got pending changes that when I compare declares as being identical. This post comes up with a way to prune out all the identical ones and to leave you with only the files that actually have changed.
The problem might have to do with different workspaces that you use or have used possibly on different computers. Check the workspaces that exist and see if the files are checked out anywhere else. Here the sidekick tool mentioned in a comment can help.

Source Control Explorer Shows Pending Changes, But In Pending Changes Window does not show

In TFS Source Control Explorer it shows pending changes (edit,[more]) with my name, but the Pending Changes window does not show any pending changes.
What I thought is, months ago my Visual Studio crashed, and at that time some files were checked out (which I was not aware of, due to the automatic checkout nature of TFS). Due to that, I copied a new VMImage, without undoing the pending changes (which are currently showing in Source Control Explorer).
One of my team members wants to checkin a new version of that particular file. Now, I need to undo my pending changes.
It sounds like you have them checked out under a different workspace. Try going to View->Other Windows->Source Control Explorer, then open the Workspace dropdown near the top of the screen, and select "Workspaces..."
I would suggest simply deleting any extra workspaces shown.
Steps to reproduce:
Make non-conflicting edits to files in TFS.
Get the latest version of the project from source control.
Sometimes, pending changes will be marked as non-pending and all project files are saved, resulting in no pending changes in the Team Explorer.
Workaround:
Right-click on the solution folder in source code explorer
Select "Compare"
In the search results, manually open files which have been edited/added and save them. This will register them as a "Pending Change" in team explorer.
This is because TFS apparently uses file properties rather than actual text comparisons to register pending changes in Visual Studio.
Tested on: Windows 7, Visual Studio Ultimate 2012.
Additional feedback from my supervisor: "Not sure if it was the issue this time, but that can happen when you disconnect from the TFS server (which sometimes happens without it being obvious). File | Source Control | Go Online usually fixes it (and the option isn’t available if you are online)."
TFS is buggy everywhere. i think you need to check out the parent folder and use TFS power toys to undo all the rubbish unchanged item.
TFS use file property to indicate whether or not a file has change, which sucks the most, and produce tons of usability problem.
If the file that you checked out is not part of the current solution, it might be hidden by the "Filter by solution" toolbar button on the Pending Changes window.
Get your changed files check out for edit
I had the same problem, I re-started VS, opened the solution and all the changes are now being displayed in the pending changes window.
Did you try to checkout the file from the Source Control Explorer view ?
For me, it worked.
I have just had a similar issue in VS2012.
To resolve the issue, I toggled the "Show xxx" dropdown to "Show Solution Changes" and then back to "Show All". The files that were missing from the list then re-appeared.
I was having a similar problem and it was due to the fact that my local version was a "non-version control solution" for some reason! meaning that my local was not really connected to the actual source code on tfs.
fix: Got the latest with override option checked. I know this could be painful if you had a lot of changes made to your local.
I was facing same issue the first answer was really helpfull. But make sure to check "Show Remote Workspaces" if you are working from different computer. In my cases the files where checked in and edited from home computer and it was showing pending changes. Deleting unwanted workspaces helps to solve this problem.
a different workspace on the same machine
a different workspace on another machine
TeamExplorer -> PendingChanges -> Excluded Changes ( I included this only because you didn't specifically mention they weren't there)
especially if you right clicked a node in solution explorer and chose check-in
Filtered based on TeamExplorer Settings #Oliver
Use a Tfs Query to find the pending changes and what workspace they are pending from.
Another option is to permanently or temporarily give them permissions to overwrite your lock. Then he can check-in anyhow.
I've seen this problem. Sometimes when I have the pending changes window in 'flat display mode', it doesn't display my changes. I find if I click the toolbar icon at the top of the pending changes window with tooltip 'Change to folder view', then they display. I think this is a bug in the Team Explorer Client.
sometimes I can not lock a branch because users have things checked out, but when I ask them about it, the pending merges/changes, only folders come up with no objects to change. What's with that?

Resources