Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TFS: View all unversioned files

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.

like image 236
Jesse Vogt Avatar asked Aug 19 '11 18:08

Jesse Vogt


People also ask

How do I check my TFS history?

Right click the solution -> Source Control -> View History.

What is Unversioned files?

"Unversioned content" or "unversioned files" are files stored in a Fossil repository without history. Only the newest version of each unversioned file is retained. Though history is omitted, unversioned content is synced between repositories.

How to Add project to Source control TFS?

In the Connect to Team Project dialog box, select the TFS instance you want to connect to, select the team project collection, select the team project you want to add to, and then click Connect. In the Team Explorer window, expand your team project, and then double-click Source Control.


3 Answers

If you are trying to determine all of the files which exist on your filesystem within a project folder that are NOT in TFS,

  1. Open visual studio

  2. Open Team Explorer (ctrl-w, m)

  3. Go into "Source Control"

  4. Navigate to the folder you want to find the unversioned files within.

  5. In the top bar there is an icon with two folders and a magnifying glass between them, hinttexted "compare folders"

    enter image description here

  6. 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.

like image 153
DevinB Avatar answered Nov 10 '22 03:11

DevinB


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.

like image 34
Edward Thomson Avatar answered Nov 10 '22 03:11

Edward Thomson


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
    }
  }
}
like image 2
Eduardo Antunes Avatar answered Nov 10 '22 04:11

Eduardo Antunes