Most recent changes done to the project - tfs

I have couple of projects in which one or more files have been updated. These updates need not change the *.proj file but the overall project dll is changed.
Each project can have multiple folders and each folder can have multiple files.
Is there a way in TFS to know which file was when updated last?

If you want to simply see a list of changesets, then you can by going to:
View -> Source Control Explorer
Ctrl-G
Find
All Changesets and select $/Team project
That will give you a list of all changes.
You can get a more fine grained control of this using the:
tf history
Command; something like this:
tf history /recursive $/Project
I believe that if you wanted to list each file then you would have to go to the API.

Related

How to check in mass changes into TFS

I have a situation where a developer made mass changes to a project outside of TFS (long story), and now we want to put those changes back into TFS (files added, removed, renamed).
Of course, TFS is not like Git; if I check out the project, then delete the files from the workspace and copy over the new files, TFS won't adapt to those changes.
I have discovered that I can do a Compare from File - Source Control, and that the Compare screen allows me to mark files as added/deleted. This helps, but is a slow process for a large project, and quite prone to human error.
So, my question is: Is there an automated way to get TFS to simply add all new files and remove all deleted ones?
I don't care about tracking history of renamed files--they can be
considered "removes" and "adds."
I have tried unbinding and rebinding the workspace; this did not work for me (or I didn't do it correctly).
I am using VS 2015, TFS 2015, and I have the TFS Power Tools.
If you are using a Local Workspace then you should be able to get latest on the workspace, then copy over all the new files in Windows Explorer which will generate pending changes and file adds.
If you go into Pending Changes in Team Explorer you will have lots of detected changes for new files etc. but you can promote them to included changes.
This isn't going to deal with file renames or deletions though so it might not be the best solution.
Alternatively you could use Reconcile Changes in Version Control
In Source Control Explorer, right-click a folder, and then click Compare.
In the Compare dialog box. select the folder versions to compare.
In the Folder Difference window, right-click the folder or file you want to reconcile, and click Reconcile.
This will allow you to choose what to add or change to version control
You might try using tfpt online. I would add the /adds /deletes /diff /recursive flags as well.
I think in almost any case you will have some conflicts/manual work to do here.
There is a blog post on a possibly similar situation that used tfpt online as well: Discover File Changes Made Outside of Visual Studio
Since I did not get to try the above suggestions, I'll post the workaround I did, in case it helps anybody else. Hopefully, the above suggestions are better than what I ended up doing.
Make sure nothing is checked out
Open solution
Team - Go Offline
Close solution
Windows Explorer - Copy latest source folder into the current source folder (Windows Explorer will do a Merge).
VS - Open solutin, select solution file
File - Source Control - Advanced - Change Source Control
if you get a message about unloaded projects, make sure all projects loaded. Click "Reload" on those that didn't.
Shift to select all project, click Bind
Do a Compare in Source Control Explorer. Manually add all new files. Manually delete all deleted files. Frown.

TFS 2010 - bulk checking out of just .html files this time... How?

I need to bulk-check-out of all our .html files.
(to do a masse edit-replace from the command-line, and check them all back).
This is just a one time thing. I see a lot of threads on how to exclude files types but at project inception and definition level, like
Team => Team Project Collection Settings => Source Control File Types
or for TFS 2012 the .tfignore file.
But..
1) This seems to be for permanent exclusion at the project level. I don't want to touch the overall Source Control settings, colleagues work with all these other files types I need excluded.
2) These filters are all defined by what you exclude. But it would be much easier in that case, to define what you want to include (here .html files), so in essence, to say include 'A', instead of having to say exclude 'B', exclude 'C', exclude '...' going after the whole alphabet.
Thank you
For a bulk checkout, you can use tf checkout.
Open a command prompt with the current path within your local workspace and issue this command to check out all .html files:
tf checkout *.html /recursive
If you want to limit the checkout to part of the source tree, specify that in the itemspec:
tf checkout $ProjectCollection/Trunk/Project/*.html /recursive
If you are using TFS 2012 or newer, just make sure you are using a local workspace and you don't need to explicitly check-out anything. TFS will automatically detect local changes and put them in the Pending Changes list.
So just run your tool locally to go and bulk change all the html files. Then fire up VS and look in the Pending Changes window, all changed files should be listed and can be checked in.

Moving code from one TFS server to another

I have a local structure of directories and files. This codebase is a latest version of all of my code. I now need to upload that into TFS. How do I upload a bunch of folders and files at once?
Currently, I'm looking in the "Source Control Explorer". I see "Add Items to Folder". However, I can't figure out how to upload folders and files to the project I want to add it to.
What am I doing wrong?
Thanks!
First, make sure your local folder is mapped to a TFS
workspace.
In the Add Items to Folder dialog set the folders
and files you want in the Items to add and Exlcuded items tabs. These items gets into the list of pending changes.
Check-in pending changes.
if you want to keep your revision history you need to follow these steps:
http://www.robusthaven.com/blog/release-management/Migrating-TFS-to-New-Hardware
else follow #KMoraz answer to use source control explorer and right click to add items to the repository.

tfs: how to unlock changes

I originally edited a file, which did a checkout. I received a new computer, and now I want to edit the file. I don't care about the original edit.
TFS reports that another user has an exclusive lock on the file. It's not actually another user, it's me, but the machine is different, so the workspace is different.
I tried unlocking with the tf commandline using the following command:
tf lock /lock:none /workspace:oldmachinename;domain\me /recursive $/projectname/directory /s:http:tfs:8080/tfs/project
I get no errors, but when I go into Visual studio 2010 (We're using tfs 2010 as well) The files remain locked.
What am I doing wrong?
Have you tried using TFS powertools?
Once you have that, you can right-click on your folder or file, and choose Find in Source Control -> Status. After you click Find, it should show you all the check-outs, or files that are checked-out
You should then be able to right-click on the checkout and choose "Undo..".
While this is generally issuing the same command line arguments, I've had good luck with it.
Deleting the old workspace is probably what you want to do. You can do this with the tf workspace command, but an easier method is to use the free TFS Sidekicks add-on which gives you a GUI to manage and delete workspaces.
If you aren't intending to use the old workspace again, it would be a good idea to (carefully) delete the entire workspace. This will clean up everything relating to it, and mean that it no longer "pollutes" listings of your active workspaces, etc.
You can also break the lock on a single file, but you will need to have appropriate permissions to be able to break locks. See here for a specific explanation of how to do it.
Try something like this:
The following example unlocks and makes all files in the src/ Team Foundation version control server folder available for check-out and check-in by other users.
c:\projects>tf lock /lock:none src/
More documentation here:
http://msdn.microsoft.com/en-us/library/47b0c7w9.aspx

Using TFS source control - how to remove files

I am a lone developer, and I am now using TFS 2010, having until recently used VSS.
I have not found it easy to get any books for beginners to help me use this.
So I have now got my project in source control. But when I check in I get references to a number of files that I no longer use. How do I remove files from the TFS Source Control repository?
So in the example below, you can see lots of files from different projects that I do not want to see.
Click on the last icon that looks like a solution (.sln) file icon (last icon on the top vertical row). It's right next to the refresh icon and just above the "Comment" box. That should clear all non-related project files, and only show the files on your current project.
In Source Control Explorer in Visual Studio, simply right-click on files and folders and choose "Delete". Then right-click again and choose "Check-in pending changes".
You need to Destroy those files first, then only those files will get removed from source control.
You can't make any changes in those files - they remain in source control until you destroy them permanently from TFS.
For more info about how to destroy see TF Destroy command utility.
The files in your screenshot are (mostly) listed as add - they are not in TFS yet, so deleting them from TFS is not what you want. Rather you want to ignore them, though that can be tricky: How to ignore files/directories in TFS for avoiding them to go to central source repository?

Resources