Steven's profileDevelopmentalBlogLists Tools Help

Blog


    01 July

    Rolling back a changeset in TFS

    In TFS 2005 and 2008 there is no easy way of rolling back a changeset. Sure, you can do a "get specific version" of each file from before the "bad" checkin occurred, and then check the older version back in. But this really sucks if you have a lot of files in your changeset.

    Luckily the Team Foundation Power Tools can help you here. One of the command line options is as follows:

    tfpt rollback /changeset:xxxx

    Here, you simply replace xxxx with your changeset number, and the power tools will take care of the rest.

    First, it will "get latest" of the workspace. Next it will perform an operation for each file that is required to roll it back. For example, if you added a file, it performs a delete. If you deleted a file, it performs an undelete. If you simply edited a file, it will get the code from the changeset previous for that file. The result on the command line indicates which changeset was used for each file it rolled back.

    It then pops up a window requesting confirmation for all the files. After this, it checks out all those files it will roll back and you can then check them in (or only check some in if you so wish).

    One caveat with this process is that when you are executing the command line, you might get an error: "Unable to determine workspace". This simply means you are not currently in a folder that is part of a workspace. Change directory into a folder that is stored in the workspace you want to use (for those that use multiple workspaces with different folders).

    Good news is that Rosario will have rollback features incorporated. Check out the help for rollback for more information:

    tfpt rollback /?

    Technorati Tags: ,,,,