How do I view all unversioned/uncontrolled files using TFS 2010 and VS 2010?
The problem that I am currently running into is after creating a new controller and view using the context menu (MVC3) I decided to roll back all those files by undoing the add in my pending changes window. I found that the files were no longer in TFS but are still on the disk. I would like to see the files that are currently on the disk but not versioned by TFS.
This is trivial in Subversion and Git (these files will always appear unless told to explicitly ignore them) but I am not seeing an option to view these in TFS - they do not appear under in my Pending Changes view. I am new to TFS so I assume I am just missing something.
If you are trying to determine all of the files which exist on your filesystem within a project folder that are NOT in TFS,
Open visual studio
Open Team Explorer (ctrl-w, m)
Go into "Source Control"
Navigate to the folder you want to find the unversioned files within.
In the top bar there is an icon with two folders and a magnifying glass between them, hinttexted "compare folders"
Compare "Source Path:" of whatever it suggests (probably server version) against "Target Path:" of your local version.
It will highlight all the differences within those folders. Any files which exist in the right hand (local) column are files which are not currently stored in TFS.
Team Foundation Server does not delete files when you undo the pending add for them - this is to prevent possible data loss. (It's possible, for example, that you want to create a file locally but not check it in to Team Foundation Server - since Visual Studio and Eclipse automatically pend this file as an addition, if it were to remove the files when you undid the add then there would be no way to have a file locally that didn't exist on the server.)
The Team Foundation Server power tools have to different operations that will help you sync up your local workspace with the server.
If you have files on disk that are not on the server and you want to update them (push them to the server), you can use tfpt online. This will detect all the files that were added or modified locally and create new pending changes to update the server. This is particularly useful if you've been working disconnected from the server and want to pend those changes.
If you have files on disk that you want to remove or otherwise update with the latest server version, you can use tfpt scorch. This will detect any files that have been added, modified or deleted locally and allow you to update them with the latest server version. If you just want to see the list of files and not actually take any action automatically, there is a preview mode you can use with tfpt scorch /preview.
Assuming that you have PowerShell installed, and tf.exe (from TFS Explorer tools) and sed.exe (GNU Tool) in your path, you could use this script (PowerShell) to do the work:
if((tf prop .) -ne $null) {
tf folderdiff . /r /view:targetOnly /noprompt | sed -e '/^=\+$/,/^=\+$/d; /^$/d' | %{
if(Test-Path $_) {
rm $_ -Rec
}
}
}
Actually, an pretty easy way to remove files/folders from your file system is to simply delete (or move) the local project folders then do a "get specific version" from TFS. Be sure to check both of the "overwrite" checkboxes.
It will then pull down everything that is currently stored in TFS.
Related
I'm using Visual Studio Professional 2015
Version 14.0.24720.00 Update 1 with TFS 2013 (30723.00).
Let's say my local TFS workspace is d:\workspace
Some of my existing projects which are not in source control are lying under d:\projects and I want to add them to TFS.
When I copy Solution_A from d:\projects to d:\workspace\solution_a_team\Main, where solution_a_team is the team project folder with a branch named Main, Team Explorer says Detected: x add(s) - where I'm assuming x is the number of files transferred.
What's confusing is that the number x is not consistent. Sometimes all files are detected sometimes only small percentage of files. What am I doing wrong, or what's the best way to check these folders into TFS?
First, please check whether there are some files adding in the excluded changes. There are included changes and excluded changes in the pending changes page.
Also, it's not recommend to just copy files or projects to the workspace folder. It's not the right way to add files in source control.
If you want to add a solution in source control, just open the solution in solution explorer and right click the solution ,in the explorer select "Add solution to source control" and choose the location you want add to. If the solution have added in the source control, there will be a lock icon in front of it.
If you want to manually add files in version control, the simplest way you can Drag the folders or files from Windows Explorer into the folder in Source Control Explorer . More details please refer the link from MSDN: Add files to the server
Moreover, you can also achieve this through TF command, or check in files through windows file explorer directly by TFS Power Tools.
Steps I made leading up to this problem:
I created a project in Visual Studio Online (TFS) and checked in the entire contents (about 200mb) of a folder called classic.
I created another project and checked in the entire contents of a folder called dlls.
I decided that it would make more sense if these two folders were apart of the same project, so I deleted both of the ones I created in steps 1 and 2.
I created a new project and mapped it to a folder on my computer that contains both the classic and dlls folders.
In Visual Studio 2013, I go into "Source Control Explorer", right click and select "add existing item", and try to add both folders.
In this prompt, none of the files that I need to add are shown! The prompt gives me a message at the top that says "Files already in version control are hidden". If I click through each folder they are blank except for other folders. I verified that the files are still there on my local machine.
The problem is, I deleted those 2 projects in TFS that had the files. Do those projects still exists somewhere? How do I completely get rid of them? Where can I find those files at if they are "already in version control"?
This may be happening because even though you deleted the files from the server, you local workspace still thinks they are available on the server. The easiest way to recover is if you can delete your workspace and recreate it. Be careful not to delete your local files without creating a backup.
I deleted a local copy of a TFS source-code branch (actually I renamed the branch and had to delete the old-named version), but Source Control Explorer window in Visual Studio says I still have the latest version so whenever I double-click a file, I get an error that the file doesn't exist.
Is TFS supposed to notice when I delete a local working copy i.e. this is a glitch?
How can I address it? Get the latest version and then delete it?
Is TFS supposed to notice when I delete a local working copy...?
No. TFS TFVC expects that it controls your working directories, at least with a Server Workspace. When you start doing things without telling it, then it has no idea.
If you want to remove files from your local drive, do a get of changeset 0 on that path (where the files won't be) and/or delete your working folder mapping or delete the TFS workspace.
Why does it work this way? Performance. If you have 10+ GB of sources, you can't afford to have your version control system scanning your filesystem to try to figure out what you've done. That's why TFVC Server Workspaces work this way.
Change your workspace to a Local Workspace if you have only a small bit of source code and you want to scan the filesystem for changes. Or switch to Git in TFS if you want a complete distributed experience.
I have a folder where I drop 3rd party dlls into that is stored in TFS.
If I replace a dll with an updated version, how come it doesn't appear in my pending updates window?
(vs.net 2012)
This will probably be because you are using a Server Workspace. When using a Server Workspace you must instruct TFS that you want to Change a File by performing a "Checkout", either from VS, the tf command line, or the shell extension in the power toys.
This is because Server Workspaces try to save resources by having the server track all changes and not by inspecting the files on disk. If, you want TFS to pick up changes when you change files in explorer, without an explicit "checkout", swap to "Local Workspaces".
I'm using TFS with VS2008 and VS2010 and in the TFS collection I have several projects.
I've mapped the TFS root to a local drive to preserve the TFS folder structure and I've done a Get Latests of several subfolders.
I downloaded also an unwanted folder so I deleted the local folder contents but now in the TFS I see that folder in black and "Latest" Yes. How can I tell TFS that I've locally deleted a folder that I previously downloaded?
I think the problem is that you do not agree with TFS on what "latest" mean.
"Latest" in TFS mean that nothing has changed on the server since you did get latest. It do not mean that what is on the hard drive is equal to the latest version on the server.
So TFS shows what it is supposed to, see this question for more: Why doesn't TFS get latest get the latest?
The intended solution for folders on the server that you do not want to have on your local hard drive is "Cloak", as MBulava mentioned. (Right click folder -> Cloak). If you do not wish to have a folder on your hard drive I recommend this solution as it will never be downloaded until you uncloak it, and will show as greyed out and "not downloaded".
If you want to look at the differences between the contents on the hard drive and the server version you can use the "compare folders" feature. It will show that the folder is deleted on the hard drive.
If you want to get the folder mapped and grey (as the other folders you did not download) you can cloak it, and then uncloak it but answer "No" to downloading it now. This is equivalent to not downloading the folder in the first place.
Martin Woodward has a cool TFS Top Tip #11 - Removing source control files from your local file system blog post that answers this problem without resorting to cloaking.
You need to Get Specific Version, change the Version Type to Changeset and specify 1 for Changeset number. His blog post goes into detail about why this works. I've verified this behavior in Team Explorer for Visual Studio 2013, 2015 and 2017.
Update:
If you have got a bunch of folders to process you can use the command line as follows replacing folderName with the relative folder as the Client itemspec or the equivalent Server itempec:
tf.exe get folderName /v:1 /recursive
Mbulava's suggestion to use 'cloak' will leave the files and/or folders on the TFS server but will remove the files / folder from your local version and from the 'Get Latest Version' request.
If you have deleted files from your local directory and you then want those changes to appear on the server you need to go to the TFS director, select the files you want to delete, right click and delete the folders. Then you need to 'Check In' the pending deletion changes to the TFS server. TFS server will then delete the files / folders.