CodeLens shows incoming changes from branches / folders deleted from TFS - branch

We had deleted some old unused branches and now CodeLens shows incoming changes from those deleted branches above every single method in our solution.
incoming changes
We've tried to convert branch to folder and then delete it but with no luck.
Also I tried solution from this topic https://social.msdn.microsoft.com/Forums/vstudio/en-US/812e6977-7064-474b-b0e1-7f3ab6c53bfc/ , but still - no luck.
Any ideas?

You can use the CodeIndex command in TFSConfig to delete or rebuild the CodeLens data https://www.visualstudio.com/docs/setup-admin/command-line/tfsconfig-cmd#codeindex

Related

TFS - reconstructing lost overwritten code?

I was working on a solution and under the assumption that I had already checked in my changes, I pulled down a new version of the solution and all the changes disappeared.
One of my colleagues suggested that as I often ran it in debug mode that there might be a dll kicking about that I can reverse engineer but dlls all seem to have overwritten too.
This is about 2 weeks worth of work so any help would be appreciated.
If you didn't shelve or check in the changes before the overwritten, I'am afraid you'll not be able to revert the file.
However when you edit the files in local, the changes will be temporarily saved to the TFS temporary diff files in "C:\Users\{user}\AppData\Local\Temp\TFSTemp". The files all have names like "vctmp38604_939733.cs". You can get the changes from them.
So, you can have a check for the folder, hopefully the diff files still there.
Just a suggestion: please ALWAYS shelve or check in code in time in case missing the changes.

Get back lost shelf changes

I have shelved my 26 java files changes via Intellij Idea 2016.2.1 and I checkout to different branch.
When I came to old branch to check my shelved changes.
I gone a mad now, I lost all the files. I was worked nearly two months
Can somebody help to get it back?
You can restore the state of those files if they were edited in IntelliJ. Use local history to see all the changes made in IntelliJ (VCS -> Local History -> Show History).
Even there isn't Shelf tab in IDE you can find shelved changes as patch files at {ProjectName}/.idea/.idea.{ProjectName}/shelf/.idea/shelf.
Then your can apply any selected patch.
I was able to view lost changes and revert back to them by:
right click on project directory, select Local History > Show History
Find the entry in the history menu that you want to restore. You can examine the files by double clicking on the entry and the files to examine differences.
Right click on the entry you want to restore, and select Revert
Note in my case Git>VCS Operations>Show History showed nothing. Only through the Project Files menu.
Andrei's answer was helpful for my situation where I renamed my project and my previously shelved changes were no longer found under the shelf, but I did run into an issue when applying the patch file because I was prompted to "Select missing base" for various files in the patch. Similar to what is seen in the screenshot below:
https://youtrack.jetbrains.com/issue/IDEA-183910
I was able to avoid having to "Select missing base" for various files by first changing the default shelf location and then applying the patch.
https://www.jetbrains.com/help/idea/shelving-and-unshelving-changes.html#change-shelve-location
Also, I found my patch in this location:
{ProjectName}/.idea/shelf
instead of the aforementioned location:
{ProjectName}/.idea/.idea.{ProjectName}/shelf/.idea/shelf
Maybe this will help someone:
I lost part of my shelved changes in combination with an update of IntelliJ. I'm not sure if the update was the reason but eventually most of my most recent (and important) changes were gone.
I couldn't restore them from local history as this does not "survive" an update of IDEA. But in the files I saw that there still is some data:
C:\Users\myUser\AppData\Local\JetBrains\IntelliJIdea2021.2\LocalHistory had a changes.storageData with ~50MB.
Copying the files to the folder of the new version didn't help as the files got overwritten again.
Solution:
I was able to get the old version of IntelliJ (2021.2) here and installed it. This can be done in parallel, without removing the newer version.
Here I was able to retrieve my changes from the Local History and shelve or apply them again.
Hint: Backup the "Local History" folder (or the whole IntelliJIdea20xx.x folder) before you start. I don't remember if I had to copy it in there again or if it worked out of the box. (Just to be sure the local history doesn't get lost).
I've also experienced this bug repeatedly and hence no longer use shelved changes, but rather the Git CLI directly. As of 2022 Jetbrains IDE's still cannot be trusted with their "Smart Checkout" feature, which has a small probability of the total loss of your files (experienced personally in both IntelliJ & Rider).
Unlike another comment here regarding using the Local History, this did not work for me as the history showed nothing. I've also lost many hours of work due to this bug which remains unfixed.
The solution is to use "git stash -u" on the command line, then checkout the desired commit. Once youre done, type "git stash apply" to restore your files. Trusting the "smart checkout" feature is like playing Russian roullette. It's IDE magic that may just fail and you lose everything.

Move file in one AccuRev workspace that has been edited in another workspace

We have a need to refactor a code base. The thing is that this will be done by one person and it would be desirable to avoid having the rest of the development team sitting idle while this job takes place.
We therefore tried the following scenario to see if it is possible to work in parallel.
Created file test.txt in directory first in developer A's workspace.
Promoted this file.
Updated developer B's workspace, thereby getting file test.txt
In A's workspace moved file test.txt to directory second.
Promoted this move.
In B's workspace edited file test.txt while it still resides in directory first (no update is made thereby emulating that work is done while refactoring is taking place).
Tried to promote and got a message saying that file test.txt had been modified (correct, file has been moved).
Tried to merge but got an error message saying that AccuRev can't merge since the file is missing in directory second (where it has been moved).
Tried to update B's workspace but that is not allowed since there is a modified file that needs to be merged first.
We are now stuck in a catch 22 situation.
We did try to place a fake file in directory second but that is not being recognized since this file does not belong to the workspace.
Has anyone out there tried something like this and gotten it to work?
It is of course possible to copy files but if there is a better way we would be grateful to hear about this. Or if this is a known bug or limitation in the tool.
We will contact also contact AccuRev support but I thought that I might be able to get some useful tips from the community.
Currently we are using AccuRev client 5.5.0.
Thanks for any suggestions on how to make the tool support this operation.
Referring to your steps 6 & 7: In AccuRev 5.5 after a file is edited and has a (modified) status you first have to keep before you can promote.
At step 8 you could try doing the merge from the Browse Versions view of the file. That way you can select any node to merge with, including the one that has been moved.
Step 9. An AccuRev update will not run successfully if one of the files to be updated is (modified). This is by design. You can keep the file so it has (kept)(member) status then run the update.
David Howland
After contact with AccuRev support the answer is that the only option available is to copy the file to some temp directory, revert the changes, update the workspace and copy the file into the new location in the workspace.
AccuRev will at least tell you which files you have to copy since they will be marked as modified.
I could experimentally verify David's remark to step 9 using AccuRev 5.5.
Let's assume that in the workspace of user A the file was moved and the move was promoted, while in the workspace of user B the file was modified and user B is about to promote his/her change.
Before the file is kept, it will not be possible for user B neither to merge nor to update. But after keeping the modified file the update is possible. The file is first marked as overlap, then the merge succeeds in the new location. Basically, this avoids creating a copy of the file, reverting it and restoring it in the new location after an update, which can be quite cumbersome, as AccuRev does not reveal easily where the move goes.
If user B promotes the modification before user A promotes the move, all goes smoothly, i.e. on update the moved file appears as overlap, but easily merges into the moved file in the new location.
Similar results are obtained when the two users have workspaces connected to different streams and the overlap occurs on a common parent stream. Only if the file is unkept, an error can occur (i.e. only if the move is promoted before the change). Then a simple keep allows to proceed as usual (update, merge, then promote).

AccuRev: Some files from the backing stream aren't in my workspace and aren't Missing

3 files present in the backing stream in AccuRev aren't in my workspace after Updating it.
Some things I've tried:
Checked the Missing search. They don't show, with or without timestamp optimization.
Recursively populated the parent of the directories where the missing files are(n't). Got nothing.
Manually copied them from another workspace under the same stream, where they do show. Those copies appeared as External in my workspace, so I deleted them.
As per this question, did accurev show -fx wspaces. Target_trans for that workspace is the same as Trans.
Ran accurev update -9 anyway. AccuRev says everything's up to date, nothing to do.
Other possibly-relevant info:
Two coworkers with workspaces off that same backing stream have the files I'm missing.
All 3 "missing" files are in one of 2 directories that were renamed fairly recently.
The stream hierarchy is shallow, only one parent between the backing stream and the root. However, that parent stream wasn't always there. It was recently inserted, and all changes from our prior release change paletted into it, so the issues list for the backing stream would reflect only changes since the prior release, not since the beginning of time. It has had that effect, with no other anomalies I'm aware of.
I could abandon this workspace and create a new one, but I'd rather not if I don't have to. Any further suggestions would be appreciated.
Could they be excluded?
Check your include/exclude rules.
If they are not, create a new workspace. If they appear in the new workspace, just remove the old one. I have seen this issue before in the past.

TFS History Lost

I have come across an issue that looks like TFS has permanently deleted a branch and all of its history and is not giving me the ability to interact with any of the changesets that were in that branch. Here is what happened:
I created a new branch(A) off of an existing branch(B).
I used A for a few months.
I merged everything in A back to B.
I deleted A by right clicking on the branch in Source Control Explorer and clicking delete and checked in the change.
[At this point I didn't check to see if A could be undeleted, and didn't notice anything amiss]
2 weeks pass
Now I want to view the history of a file that was merged
I go to the visual studio settings and check the box that shows all deleted items
A is nowhere to be found
I check to see if some other branches that I had deleted in the past were visible, and they are still present.
I look in the change history of the parent directory and I can't even see the changeset from when I deleted A.
I have admin access to the TFS database, but don't understand the schema well enough to search for all "delete" changesets.
I've tried to use the API in Microsoft.TeamFoundation.Client to get more information, but it isn't providing any more records that the TFS history window did
Update
I just ran a a tf destroy command on a test branch to see what the symptoms are, and the symptoms are consistent with what I'm experiencing. I suspect that this branch was destroyed, now my goal is to find out if destroy leaves behind any information about who or when
Further investigation reveals that a team member on a different project had run a cleanup script during the two week period that had invoked the destroy command, accidentally destroying some of our deleted branches. The advice in How to find out who ran the TFS Destroy Command? revealed who it was, and how it had happened.