tf.exe undo pending changes from other users

2019-05-18 00:17发布

问题:

I am looking to migrate our TFS projects to another server. Before doing this I want to inspect all pending changes, undo them (or tell the person that has it checked out what it's all about) and lock the project on the old server.

For this I need to undo checkouts in very old workspaces that no longer exist. I'm now looking for ways to make this work. I realise there are a bunch of other questions like this, most with answers that point towards using tf.exe, which I am also using, but there's one thing that I just can't seem to get my head around.

Here's the deal. I'm using the following command to check to see if there's still files checked out by anyone.

tf status "$/MyProject" /s:MyServer /u:* /recursive

This presents me with a list of all files that are checked out and by whom. To undo the checkout I can now use this command:

tf undo /workspace:"TheWorkspace";TheUser 
   $/MyProject" /server:MyServer /recursive

This is all very nice, but notice how I need the workspace name to make this work. This name is however not returned by the tf status command. So now I'm forced to mess around with the workspaces command to figure out which workspaces a user has like this:

tf workspaces /server:MyServer /owner:TheUser /format:detailed

There has to be another way right? This way I'm just looking through a massive report on workspaces for each user (some have had as many as 6 computers/laptops over the years, all with dozens of workspaces), it's no fun :(

Is there any way to make tf status report the workspace name as well? Or make the undo command work across workspaces?

Any help would be appreciated.

回答1:

tf status supports a /format parameter. The brief output (which is the default) doesn't include the workspace. the detailed one does.

tf status "$/MyProject" /s:MyServer /u:* /recursive /format:detailed


标签: tfs