Cannot eliminate phantom pending TFS change - visual-studio-2010

Somehow, due to folder renamings and various other source code changes, I'm having an irritating problem. I'm showing a pending change for a file that cannot be undone in TFS.
This is a little hard to completely explain. Here is what the directory/file structure looks like in TFS:
RootFolder
Folder
FileA
FileB
OldFolderThatWasRenamedToFolder (shows add icon)
FileA (shows "edit" pending change)
"OldFolderThatWasRenamedToFolder" had been renamed to "Folder" and is committed to TFS like that. The "FileA" under that non-existing folder references the same file as "Folder/FileA" but registers as a different file; for example, if I change "Folder/FileA," pending changes are shown for both "files." Whenever I undo pending changes for the phantom file, TFS reports the error:
No pending changes were found for .../Folder/FileA.
I cannot get rid of this annoying false pending change. I've done an update in the folder forcing an overwrite and even deleted the folder prior to the update. How can I eliminate this phantom pending change?
Update:
I found a potential clue. When I compare the "pending" file with the latest, no changes are detected, but when comparing with the "Workspace version," the file is compared with an older version of the file. I've recently tried deleting my workspace and creating a new one, but the same problem persists. What exactly is going on? Where are these pending changes even stored? Is there some file I can manually edit?

In visual studio 2010, you can right-click on the phantom pending check-in on the "Pending Changes" panel and click "Undo..." on the popup menu, then click button "Undo Changes" on the dialog box "Undo Pending Changes", the phantom pending check-in will be removed from the list.

You should be able to undo the pending change with a 3rd party tool called TFS Sidekicks.
It is a free set of utilities by Attrice. I use it especially when I (or a client) come across such problems, as well as permissions issues, and the like.
Moreover, the tool will allow an administrator to do the same for other users. That means that it will solve situations where code is marked as checked out by a user that may no longer exist in the system.
Download it at http://www.attrice.info/cm/tfs/index.htm
Hope this helps.

I figured out a way to fix this using the tf.exe command line. By entering this:
tf undo /workspace:MyWorkspace $/.../RootFolder/OldFolderThatWasRenamedToFolder/FileA
...I was able to undo the pending change. If anyone knows how to do this same thing without resorting to the command line, I'll accept their answer instead.

I know this is an old post, but I expierenced the same thing.
What I found: John Kurlak's command line worked for me. I wanted to try something so I ran the TF MERGE again. This time I closed all Visual Studios open and then reopened it. The files showed up in Pending Changes and was able to Undo from there.

I know this is an old question, but I just faced that issue and I was not able to figure this out with sidekicks or tf command line tool. In my case the solution was close the solution and delete the .suo file.

John Kurlak's comment helped me a lot, but let me describe what issue happened in my case and how I solved it.
I've tried what he has suggested:
I opened the developer console, did a cd to the directory of my branch, and ran:
tf undo * /recursive
Then selected "All" when the tool asked "Undo your changes...? (Yes/No/All)".
In my case that was not enough, because NUGET left some files which were not added to TFS. That caused the tf tool to abort with the error:
TF400024: The change on
C:(SomePath)\themes\base\images\ui-icons_cd0a0a_256x240.png cannot be
undone because a file already exists at
C:(SomePath)\themes\base\images\ui-icons_cd0a0a_256x240.png. The file
must be deleted from disk for the undo to succeed.
In this case, I had to delete those files mentioned manually, and then retry until it succeeded. That had to be done a few times.
Note:
Those files can be found easier in the file explorer if you have the TFS power tools installed, because the files belonging to TFS have a green triangle in their icons, the other filies (the ones you need to delete) not.

I had a similar issue with a project that is stuck in AX version control/pending objects with “Add” action. I could not get rid of it by clicking on “Undo checkout” because it no longer exists in AX projects, local repository, nor in VSTS. To get rid of it, I created the project in AX/projects/shared then was able to get rid of it by going to AX version control/pending objects and clicked on “Undo checkout”. I believe this occurs when you create an object in AX, add it to version control, then rename the object afterwards. Hope this helps.

I am still new to VS2010, but this is how I fixed this issue for me:
Go to Source Control in the Team Explorer panel. In the Source Control Explorer, right-click the directory, project, or source code file for which there are pending changes to be ignored. Select Undo Pending Changes. A modal dialog appears confirming the Pending Changes that will be undone. Select Undo Changes, and voila! No more phantom pending changes.

Related

Why does TFS show pending changes for all my files when I haven't changed anything?

I am new to using TFS source control.
I have a large project which I have been porting from SVN. I am checked in and up to date with all projects. However, I opened up Visual Studio today and all project items are in the pending changes included window even though there are no changes.
I haven't touched or edited any of the files for my TFS files since last time.
To verify, I used Araxis Merge to do a folder comparison and can see that no actual changes have taken place.
Why are these unchanged files appearing in my check-in window?
Here is an example of a diff in visual studio from the previous version:
I can't see anything!
Hopefully this shows my local workspace
When you create or edit a workspace, you can specify whether its location is Local or Server. Local Workspaces are TFS's attempt at DVCS and actually gives you a much more SVN-Like experience.
Edit the workspace and choose advanced, you could see the Location of workspace type.
Maybe formatting, line endings, encoding. Do a diff using Beyond Compare or something to see what changed.
If nothing changed, check if you are using the same workspace. You may select another workspace than you used.
In Source Control Explorer, check if you choosed the workspace the workspace you were work in.
If all above not work, you could also try this workaround, select all the files in "Pending changes" window and activate the context menu. Then click "Undo..." > "Undo Changes" > "No to All".
The files without changes will be rolled back. More details please take a look at this question: how to undo pending changes of files that are unchanged?

Pending Changes dialog shows files outside solution that shouldn't be there

If I open VS without opening a project/solution, I get a list of files in Pending Changes. The folders marked in red are solutions in my workspace, and those marked in green are branches of the solution.
However, when I open the respective solutions directly, none of those files are there. Somehow there is some overlap of what VS/TFS thinks needs to be checked in, even though in this case it is wrong.
I opened each solution from Pending Changes in turn, and there are no files to be checked in. I don't understand what (or why) it's showing me this list, and am concerned that if I accidentally check-in while showing "All" pending changes instead of solution-specific ones, that I will lose work.
Can anyone please explain why its showing these "phantom" pending check-ins? Even more bizarelly, the same of the solution in the title bar of pending changes is not even remotely related to some of the files shown.
If I delete my workspace, then create a fresh one, and then get recent, the problem goes away for a few weeks, but then randomly files start to appear back here.
This could be a source control binding error or some TFS cache issue.
Try to unbind/ bind this files in source control. File > Source Control > Advanced > Change Source Control
File > Source Control > Add to Source Control
Detail ways please refer: Project not showing as checked-in to TFS in Visual Studio 2013
Also give a try with clear VS and TFS cache

Cannot synchronize my project in VisualStudio

My team and I started a project at Azure and we have a git as the VCS/SCM.
One of my partners had made a few changes, and he had commited them. When I try to get those changes at my local repository, and I press sync at the Visual Studio, the following message appears
Cannot merge because there are uncommitted changes. Commit or undo
your changes before merging again. See the Output window for details.
The output window shows the message below
Cannot complete the operation because of existing changes to the
following file:Project\Project.csproj
I have searched everywhere at google, but I did not find anything similar.
Can anyone help me with this?
We are stack.
Thanks a lot
It probably means VisualStudio automatically added some references to the file ProjectProject.csproj, where it keeps general project settings. In VisualStudio 2013 you may do:
Go to the TeamExplorer
Select "Changes"
Search through Included and Excluded Changes, .csproj file is probably there
Right click on it and select compare with unchanged to see the differences
Now choose to commit it or undo the changes (if, for example, the changes are not necessary) to be able to sync with the current repository.
I had this same dilemma and it turned out that somehow the file that was preventing me from switching branches and was in my solution, was not being tracked like the other files were. I just added it to source control via the explorer window, committed and pushed it, then I was able to switch branches just fine. Hope this helps.

Pending changes in AnkhSVN only shows files from current solution

I'm working under a single repository and mostly in one solution.
However, during the work on the solution I do change other files as well, when I come to commit, however, AnkhSVN only shows the files that are part of the solution. That forces me to use TortoiseSVN to do the commit on the whole directory, which in turn misses some of the files that I added with AnkhSVN.
The simplest solution to this would be if AnkhSVN showed me ALL the pending changes for the repository. A worse alternative would be if AnkhSVN flagged added files so that TortoiseSVN would be also aware to them when doing commit from it.
Anyone knows a solution to these issues?
Thanks!
You can set an option to auto add files when new files are created that should be versioned by going to Tools -> Options -> Source Control -> Subversion Environment. Select "Directly add new files to Subversion" here.
Another alternative to make "New" files "Added" is the "Apply to Working Copy" command, available through the drop down next to the Commit button in the Pending Changes window.
In TortoiseSVN, there's a checkbox in the commit dialog "show unversioned items". If you check that box, the files that are not added yet are shown as well.
You can right click the svn folder then TortoiseSVN-->Add , will show all the items which is not included for supervision.
check the screen shot

How easy is it to roll back a file that has been checked-in in TFS?

I've (apparently) checked-in (added) a file that shouldn't have been added to a branch. I need to revert this, but since then, 20 or so changesets have been added to the repository.
I'm used to working with Subversion, where it's only a few clicks and it's out. How easy is it in TFS?
TFS is a pain to use in general (personal and biased opinion). Here's a how-to article from Microsoft on how to proceed to revert changes back (warning: more than a few clicks away).
As given in that article, the steps to revert to a prior version of (a) file(s) are:
In Source Control Explorer, right-click the file whose changeset you want to roll back, and then click Get specific version on the
context menu.
In the Get dialog box, select the prior version of the file, and then click Get. For more information, see How to: Retrieve
Old Versions of Files from
Changesets.
After this file is in your workspace, right-click the file, and then click Check Out for Edit on the context menu.
Right-click the file again, and then click Check In Pending Changes.
In the Check In - Source Files dialog box, select the file, and then click Check in.
The Resolve Conflicts dialog box appears.
Click Resolve to open the Resolve version conflict dialog box.
Select Discard server changes.
Click OK.
NOTE: To review your decision before discarding the server changes, you can click Compare to view the server and local copies
simultaneously.
In the Resolve Conflicts dialog box, click Close.
In Source Control Explorer, right-click the file, and then click Check In Pending Changes.
In the Check In - Source Files dialog box, click Check in.
As #Darin has posted, you can simply Get the state of the previous version/changeset onto your PC and then check it in as a new version, thus undoing the effect of the check in. This is dead easy and can be done from the GUI, but does involve a fair bit of faffing around.
If you're happy to use the command line, you can also command TFS to rollback the changeset for you. This does all the "work" of the above option, leaving you with a changeset in your pending changes that will undo the checkin's effect, but hopefully with a bit less effort.
If it is added by mistake, you don't want to roll back. Instead, you want to tf destroy (from the command line) that file in each of the branches.
TFS can be a bear to work with if you add a file, delete it, then re-add a new file with the same name. It makes merging much more difficult.

Resources