views:

1936

answers:

5

We use a batch file to generate code, and it automatically checks out the generated files from Team Foundation Server (TFS) so that it can regenerate them. The majority of these files are not modified, but the generator does not know this ahead of time.

The "tfs undo" command undoes the checkout, but prompts if some have been modified (which we don't want to do). We also do not want to check in the generated files right away.

Is there a command (or series of commands) to undo checkout of all unmodified files without prompting the user?

A: 

As far as I understood, in TFS if you checkout a team project, the whole project is checked out and you do not have control of which files are brought down. If you want to prevent checkins to certain files, you can lock them.

At work, we all hate TFS.

achinda99
We can check out individual files, and locking it would not allow the developer to check them in.
Robert Wagner
+7  A: 

Take a look on Undo Unchanged command of the Team Foundation Server Power Tools

Mike Chaliy
Perfect, thanks.
Robert Wagner
Watch out though! I just tried to use this, and it does undo unchanged files. However, the command also sync's your workspace up to the latest version before it does the undo. Getting the latest versions is something I definitely didn't want to do.
Scott Langham
Hum. There is a /noget switch to turn the get off, darn, I wish I'd seen that before running the UU command.
Scott Langham
Awesome stuff..very handy :)
Jedidja
+1  A: 

If you simply check all the files back in again that you checked out, TFS is smart enough to figure out which ones changes and only include them in the changeset that is recorded on the server.

TFS does this by comparing MD5 hashes of the files contents before and after check-in.

This is all assuming that your generation process is purely updating the same set of files, i.e. you will never have the case where a file that was generated in a previous generation is not needed in the next generation (i.e. you would want to pend a delete for that file) or that the files change name.

If your process could potentially need files deleting, the your best bet might be to look at the Team Foundation Power Tools command (tfpt) and use the tfpt online command that will only check out the files that have changed, and will be smart enough to pend deletes for any files that are no longer needed or changed name and pend adds.

Good luck,

Martin.

Martin Woodward
Thanks for that, however we do not want to check in the modified files at that time. The modified ones should not be checked in till the feature is done, but the unmodified ones should be removed so the dev can review the changes.
Robert Wagner
A: 

achinda99, I think you have misunderstood TFS. You can check out individual files. You have not followed the intsructions

Simian
+2  A: 

Install Team Foundation Server Power Tools and run the following from the command line using tfpt.exe at the root of your project's workspace directory:

c:\myProject> tfpt uu . /noget /recursive

Including /noget is highly recommended since it prevents a forced 'get latest' of all your project's files which depending on the total number can take a extremely long time.

Ray Vega