Delete a depot

If a depot was inadvertently created or its file content becomes obsolete, consider deleting that depot and all of its content.

Prerequisite

  1. Before you delete a depot,identify any of its changelists that have the status of shelved:

    p4 changes -s shelved //depot/...

  2. Delete the shelved files from these changelists:

    p4 shelve -f -d -c 399 //depot/...

    where 399 represents a specific changelist number.

  3. Delete the changelist:

    p4 change -d 399

Delete a stream depot

Deleting a stream depot is different from deleting other types of depots.

  1. Use the --obliterate option of the p4 stream command to permanently delete the stream from all metadata and remove the stream from pending and committed changelists:

    p4 stream --obliterate //stream-depot/stream

    If the stream is locked, include the -f option.

    The operation defaults to the report mode, which provides a preview of the result.

  2. If you are certain that you want to proceed, include the -y option:

    p4 stream -y --obliterate //stream-depot/stream
  3. When all the streams in the stream depot are removed, specify the stream depot to delete with the p4 depot command:

    p4 depot -d stream-depot

Delete other types of depots

If the depot is not a stream depot:

  1. Remove all the files in the depot with the p4 obliterate command:
    p4 obliterate //depot/...
    If you obliterate a file and its history from a depot, the file and its history cannot be recovered.

    The operation defaults to the report mode, which provides a preview of the result.

  2. If you are certain that you want to proceed, include the -y option.
    p4 obliterate -y //depot/...
  3. To delete the depot, run the p4 depot command:

    p4 depot -d depot

Troubleshoot

  1. If the p4 depot -d depot command fails, run p4 verify to ensure no files in the directory are required by the P4 Server and display a status of MISSING. If no files are missing, include the -f option:

    p4 depot -d -f depot

  2. If p4 depot -d depot continues to fail, remove any orphaned files:

    1. User the -l option of the p4 storage command:

      p4 storage -l start //depot/...

    2. Look for state done in the output of this command:

      p4 storage -l status //depot/...

    3. List any orphaned files:

      p4 storage -d //depot/...

    4. Remove the orphaned files:

      p4 storage -dy //depot/...

    5. Delete the depot:

      p4 depot -d -f depot

If you obliterated a file, but the file remains in a user's client workspace, it is because a user has the file open. Although the depot no longer has a record of the file, the user who has the file open can remove the file from their local workspace.