Jan_V
Jan_V

Reputation: 4406

Checkin multiple files with tf.exe in one changeset

On one of our builds we are kicking off some automated process which is checking out and checking in some files automatically.

This all works rather well, but at this time we are running the checkin command which looks like the following

tf.exe checkin /force /comment:"foo" /noprompt /bypass /override:"bar"

All of the files with a Pending status will get checked in.

I'd like to make this script a bit more specific and only checkin the files (2 in total) which we actually change during the build, so we know for sure no files will get checked in 'by accident'.

I've already seen we can specify a single filename with the checkin command, but doing so we will get 2 different changesets in TFS, instead of 1. We would really like to have 1 changeset, containing both changed files as the changes belong to eachother.

Any ideas on how to approach this?

Minor addition / Short term solution

For the moment I've solved our 'problem' by specifying the folder where our modified files are located, which kind of looks like this

tf.exe checkin "/my/folder/location/" /recurse /force /comment:"foo" /noprompt /bypass /override:"bar"

Note the folder location and the /recurse parameter added.

Upvotes: 4

Views: 1982

Answers (2)

Tore Østergaard
Tore Østergaard

Reputation: 4602

You simply separate the files by spaces:

tf.exe checkin file1.ext file2.ext /force /Comment:"foo" /noprompt /bypass /override:"bar"

The documentation is not clear about this point but it might be a general specification of an itemspec that it can be multiple items.

See similar question about checkout: Is there a way to check-out multiple files from various folders in TFS in a single operation

As mentioned by others you might run into problems with the command line being longer than the system supports, in which case you might need to look at other solutions.

Upvotes: 4

PatrickLu-MSFT
PatrickLu-MSFT

Reputation: 51093

cmd.exe has a limit on how long a command can be. Using the version control API, or simply 'tf checkin /i' (no arguments) is likely to be a better choice than passing lots of long filenames.

It's normal if a file becomes automatically checked out due to a change, and if ultimately the contents of the file are changed back to it's original state. At that point you would see the message about identical contents upon comparison. You could also use tfpt uu /noget /r * command to ignore Files which are identical to the originals. You'll need to have TFS Power Tools installed for this to work. Note: there is no TFS Power tool 2017.

For more details please refer below two links:

Upvotes: 0

Related Questions