Destroy: A new feature for Orcas

Brian Harry mentioned the new Destroy feature in his TFS roadmap post. I thought I would go into a little bit more detail on how destroy works in Orcas. Please do keep in mind that any of this might change / be removed before Orcas ships - so there are no guarantees.

Destroy gives you the ability to permanently delete version control files/folders from TFS.  It can also be used to destroy the file contents while preserving the change set history. Destroy can only be invoked from the command line and here is the syntax for the command line:

tf destroy [/keephistory] <filespec1>[;<VersionSpec>]  <filespec2 ... filespec3> [/stopat:<VersionSpec>] [/preview] [/StartCleanup] [/i]

All filespecs must be server paths. Local file paths aren’t allowed. Destroy is a very dangerous operation, so removing all possible ambiguity about which items will be destroyed is a good idea. Additionally, the user must posess the AdminProjectRights permission in order to destroy items.

If /keephistory is specified then /stopat becomes optional. /stopat is not allowed if /keephistory is not specified. /stopat is the version including and after that destroy will preserve the file contents for. /stopat defaults to tip (the latest version checked in of an item). The command line does not support version ranges and does support DeletionId version specs (‘X’). When /preview is specified the destroy is not actually committed but the output is displayed any way. /stopat is not allowed to take label or workspace version specs.

TFS stores versioned file content orthogonally from the versioned item histories. Destroy removes all of the non-content data when it is invoked. If you immediately want to have the content garbage collected then you should use the /StartCleanup option to destroy. If /StartCleanup is not specified then the content garbage collection will occur when the TFS database maintenance job runs. The job is scheduled to run one once per day by default.


If you have any additional questions about Destroy, feel free to ask. 



Comments (6)
  1. Buck Hodges says:

    The Version Control Server blog has shown some signs of life. Bill Tutt has written a couple of posts.

  2. RSS It All says:

    The Version Control Server blog has shown some signs of life. Bill Tutt has written a couple of posts

  3. wxt2000 says:

    I have a question about such scenario. I have created a source folder names $TP1/Lib1. Then I decided it was all wrong and i deleted it. Because my teammate is still waiting for this Library I created a new one with the same name. Right now I have sometimes problems with getting latest version. I would like to destroy the old folder while keeping the new one. How will I go about it?

    Your answer will be extremely important to me, as I have many such folders on production server.

  4. Ted Holien says:

    Will the Destroy option work even if the destroyed folders and files had participated in branch or merge operations with folders and files that are not destroyed?  (Or will it only work on completely autonomous folders and files?)  I would think that you had thought of these scenarios, but it would be nice to know whether there will be limitations in this regard.

    I’m also unclear on what is meant by "content" vs. "non-content" data.  Some clarification would be appreciated.

  5. tfsvcs says:

    wxt2000: If you do a ‘tf dir /deleted $/TP1’ you’ll notice a line that contains ‘Lib1;X123’. If you want to destroy that item, you simply do: ‘tf destroy $/TP1/Lib1;X123’.

    Ted: Yes, destroy will remove folders and files that have participated in branching and merging.

    By content, I mean the actual files content. Non-content data for a file’s history are things like still showing up when you do a ‘tf dir’ (Source Control Explorer), ‘tf history’ command still showing those versions, or the file name still shows up in as beloning in a changeset.

    Here’s an example of what I mean:

    echo blah > a.cs

    tf add a.cs

    tf checkin /i (This generates changeset 5)

    tf edit a.cs

    echo blah blah >> a.cs

    tf checkin /i (This generates changeset 6)

    If I want to keep the item around at changeset 6, but want to destroy all content (but not history) then I would do this:

    tf destroy $/teamProject/a.cs /keephistory

    So when you run the following commands changeset 5 will still show up:

    tf history a.cs

    tf dir a.cs;C5

    tf changeset 5

    However, since the file content for changeset 5 has been destroyed, trying the following will issue an error:

    tf get a.cs;C5

    On the flipside, if you had done ‘tf destroy $/teamProject/a.cs’ then the above commands would return "item not found" for a.cs all of the time.

  6. Como muchos ya sabr&#233;is hace poco Microsoft lanz&#243; al mercado Visual Studio 2008. Si est&#225;is

Comments are closed.

Skip to main content