Unable to resolve pending changes after renaming a folder - tfs

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.

Related

Computer renamed - TFS Workspace doesn't work now

Had to change my computername and domain. Now I can't access team foundation. I tried this statement to fix it.
tf workspaces /updateComputerName:MyOldComputerName /s:"http://MyServer/MyCollection"
It didn't work. I get the following error "Key not valid for use in specified state."
Not sure what to do now.
It sounds like you may have a problem that will prevent remapping the workspace. However, it's possible that the command isn't quite correctly formed, so try checking the collection URL (I'd expect it to include MyServer:8080), and in versions of TFS 2010 onwards the documentation refers to /collection: rather than /s:
If that fails, then one approach to rescue things is to create a new workspace and delete the old one. You can transfer any edited files you had checked out to the new workspace as follows:
Rename your old source code folder, so you keep a backup
Create a new workspace that maps the (old) source code folder location, and Get the latest version of the code.
If you think you deleted or added files, use a folder-diff utility to find them, and manually re-do those changes.
Now check out everything (right click on the root folder and check it out)
Copy your backed up source code over your workspace folder
Undo checkout on everything. Visual Studio will ask if you want to discard your changes. Carefully choose the "No to all" option. This means it will only discard locks on unchanged files.
You will now have all changed files listed in your pending changes.
Once you're absolutely sure this has all worked, you can delete your backup of the source.
(You can achieve a similar thing by unplugging your network cable to force Visual Studio to go offline, moving your old source code back in place of your new workspace folder, then plug the net cable back in and using File > Source Control > Go Online. This should diff your code to the server and work out what changed. I don't trust this as much as the above approach though)
Once you have the code in your new workspace, you can use the tf command to delete the old workspace to clean everything up.

TFS checkin error - could not find file

When checking in my project I get the error:
Could not find file 'C\blah blah blah'.
I have a feeling this might be a file from an old project I deleted.
I have tried deleting my TFS connection and workspaces.
This will happen when TFS has some changes staged that no longer exist on the file system. For instance, if you add some files in Visual Studio (which adds them to the changes list), delete them directly from the file system, then attempt to check in the changes, it will complain that it could not find the file(s).
To remove these changes from the list, you can open Source Control Explorer (View > Other Windows > Source Control Explorer) and either Delete the nonexistent files or right-click on the offending files and Undo Pending Changes.
You can also undo these specific changes from the Pending Changes panel in Team Explorer.
Create an empty file to replace the missing file and complete your check-in. After you have checked in the file correctly delete the file that is not needed.
Go to the project that has file 'blah blah blah', you should see the file has an error mark indicating it does not exist. Right click the file > Delete. That should take care of the problem.
I had a similar problem. I had forgotten I was tinkering with adding publish profiles for publish. TFS felt it needed to check that in, even though the output wasn't there. I simply right clicked on the App.Publish folder in Team Explorer inside of visual studio and chose to exclude. Checked everything back in with no problem.
I encountered the same error:
but my issue was a bit different. I was changing a couple of folder names and when committing I didn't add the new folders to the repo:
git add folderName
solved the issue for me.

TFS: How to merge only changes on my shelve, without overwriting local copy enterily

I'm trying to find a way to merge shelve changes with the latest version I have locally without overwriting my local files with those of the shelve.
That is, I have a shelve from date 0, on date 1 some changes were done in the tree, on date 2 I do a Get Latest Version, then when applying the shelve, changes of date 1 get lost.
No merge conflict between changes in date 1 and those of my shelve.
Ideas? Thanks!
Finally, what I ended up doing was to
1) "get specific version" to the date when changeset was taken
2) "get latest version".
That way, TFS merges latest version with changed local files. (The other way around -what I was looking for- seems not possible).
Two options spring to mind:
(Advice: Before you start, back up your code, in case there is anything in there that isn't safely stored on the server or in a shelve set!)
If you unshelve first, you will end up with locks on the shelved (0) files.
Then GLV to get the (1) files. All the files you have locked will be merge conflicts, which you can then resolve, test, and check in as normal.
Get the shelved code and copy it to another folder on your hard drive. Then GLV the latest server code. Check out the files you have changed (or easier, the root folder), and then manually merge the two sets of sources. You can then "undo check out" to get rid of the unchanged files (say "no" to the "discard your changes" question and it'll keep locks only on changed files) and after testing that your code works, check in the resulting changed files.
You need another Workspace, that is a local folder were your working copy resides (Yes, you can have more than one).
With a fresh Workspace with no changes on it, you could recover your shelve there, do the check-in, and have your original workspace untouched. Optionally, you could delete the alternative Workspace, or keep it for these kind of maintenance tasks.
For creating a new Workspace, just open the Source Control Explorer and open the Workspace combo-box on the upper toolbar. Select Manage Workspaces and create a new one from there.

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.

Visual Studio loses track of pending changes after unshelve

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!

Resources