Friday, August 17, 2007

"Undo Pending Changes..." for users no longer with the company

Well I'm back from a two week parental leave and excited to tackle TFS again. Funny how a nice break makes everything better at work. Here is a question posed to me a few minutes ago.

How do you undo a change for a person who is no longer with the company? Apparently people do leave this place. From what I can tell the needed functionality is not provided in the Team Explorer interface. Luckily it's provided in the command line tf.exe command. Here is the syntax I used.

tf undo /workspace:U0000001-XPA;Domain\U0000001 /server:http://tfs.mycompany.com:8080 $/MyTeamProject/MyApp/mainline/build.xml /noprompt

Replace the needed values. In our example, U0000001 is the user's unique ID in Active Directory. Yours is obviously much cleaner than the cryptic format we use.

Lastly you'll have to make sure you have the correct permissions. I'm in the [Server]\Team Foundation Administrators group, so I'm as close to Superman as you can get.

4 comments:

Buck said...

You can also delete the user's workspace, which will also delete all of that user's pending changes.

tf workspace /delete someWorkspace;theOwner /s:http://yourserver:8080

Buck

Mac Noland said...

Thanks Buck. I'll give that a try next time a person leaves.

Jussi said...

Using the /recursive is also a quick way of clearing all pending checkins for a given user in one Team Project:

tf undo /workspace:WSNAME;DOMAIN\user /s:http://tfs.server.url:8080 $/PATH/TO/TEAM/PROJECT/* /recursive

Mac Noland said...

Thanks Jussi! I'll also give that a try next time we have a person forget to undo their checkouts before they leave for greener grass.