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 t
There are a couple of points regarding the uu option for tfpt (recommended in most of the other answers) that were not clear to me at first. Firstly, this is the command line help that can be accessed with the command tfpt uu /?
Undoes redundant pending changes. If the state of an item with a pending change is the same as on the server, then the change is undone.
Usage: tfpt uu [/changeset:changesetnum] [/recursive] [/noget] [filespec...]
- /changeset Compare the workspace to item states at the changeset version specified instead of the latest version
- filespec... Only check the listed filespecs for redundant changes
- /recursive Check the specified filespecs with full recursion
- /noget Do not run get before checking
The /changeset option may not be used with filespecs or /recursive.
Now let me break down the command that is recommended in the other answers.
tfpt uu . /noget /recursive
tfpt uu
specifies that we wish to use the 'Undo Unchanged' command..
indicates (I guess) that the current working directory should be used as the filespec./noget
ensures that 'get latest version' is not called before undoing the unchanged files./recursive
ensures that not just the filespec will be considered but all recursive child folders and files. This seems to be dependent on the filespec - if there is none provided then the whole workspace is processed.So there are a couple of things to note here regarding the command from above...
I have found that the following command works best for me - it will process the entire workspace.
tfpt uu /noget
Note that it is still dependent on the working directory in that tfpt uses it to determine which workspace should be processed. But as long as you provide a path to a file or folder within the workspace, you are good to go.
Updated this question with an answer when working with TFS2017 and VS2017/VS2019 only.
The power tools does not exist for TFS 2017 and the old ones can't work well together with it, but apparently most of the functionality has been moved to VS2017 itself or plugins (see below).
Some actions like undo unchanged files have moved to an
extension for VS2017
extension for VS2019
"Undo Unchanged" button location:
You have to open the 'Source Control Explorer' (and leave it open) so that the 'Undo Unchanged' is displayed in the Action menu of the Pending Changes view. reported here.
Also, you can still set up Windows shell integration through an separate installer which is no longer linked to TFS Power Tools.
The windows shell integration do not work exactly the same as the powertools before, but the most important actions worked for me.
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.
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.
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.
Take a look on Undo Unchanged command of the Team Foundation Server Power Tools August 2011
c:\myProject> tfpt uu . /noget /recursive
Thanks Matt Florence for link update.
Thanks Ray Vega for actual syntax.