How do I tell who has files checked out or locked?
Team Foundation Server defaults to shared checkouts. Shared checkouts are great, because they make it a lot less likely you'll be prevented from getting your work done on a project because "Bob has that file locked right now". Checkouts are mostly informational in Team System; they let you know that someone has an intent to edit a file. For example, if you see a file that has been checked out by four other developers, you might opt to work on a different file.
Even though checkouts aren't blocking, sometimes you still may want to know who has files checked out. The command to do this is TF STATUS:
C:\>tf status /user:* /s:http://tsweb:8080
If you don't specify a user, you will only see your checkouts by default. Here, I've specified all users with the star character. And if you're in the project path, you don't need to provide the server name, either.
File name Change User Local path
---------- ------ -------- ------------------------------------------
$/Demo/ConsoleApplication8/ConsoleApplication8
Module1.vb edit jatwood c:\projects\ConsoleApplication8\Module1.vb
$/Demo/MergeConsoleApp/MergeConsoleApp
Scissor.cs !edit jatwood C:\Projects\MergeConsoleApp\MergeConsoleApp\Scissors.cs
$/Vertigo.TempusApp/web
web.config edit jimlin C:\Inetpub\wwwroot\Tempus21\web.config
Usually pending checkins can be ignored, since they'll eventually be resolved (or undone) by the developer who created the checkout. Note the little exclamation point next to the word edit-- that means an exclusive lock. It's certainly possible for developers to take an exclusive lock on a file via the checkout dialog:
And, of course, binary files like Word documents must be locked because they're unmergable. Thus, there are a few scenarios where you may need to take some administrative action:
- a developer leaves your company with a bunch of pending checkouts (or locks). Clean that up all at once by deleting the developer's orphaned workspace. This requires the "Administer Workspaces" permission.
tf workspace /delete workspace;username /s:http://tsweb:8080
- A developer leaves a file locked. Unlock it, assuming you have the correct permission. This requires the "UnlockOther" permission.
tf lock /lock:none /workspace:workspace;username $/folder/file /s:http://tsweb:8080
If merely unlocking the file isn't enough, you can also unlock and undo the pending change, if necessary. This requires the "UndoOther" permission.
tf undo /workspace:workspace;username $/folder/file /s:http://tsweb:8080