Deleting depots is a rare operation that requires Perforce super access. If a depot was inadvertently created or depot file content becomes obsolete, you might want to remove a particular depot and all of its file content (if any).
To delete a depot named "depotname":
Eliminate lazy copies referencing the archive content in the depot to be deleted:
p4 snap //... //depotname/...
Note: With Perforce Server 2011.1 and later this is a required step. Beware that running p4 snap may increase the storage required because the files in in depot being deleted may have been branched into many other files; a new copy will be created for each one of those files.
2. Find any shelved changelists containing files in the depot to be deleted:
p4 changes -s shelved //depotname/...
Then delete the shelved files from these changelists, ensuring you pass the depot path of the depot to be deleted so only those files are removed from the shelve (there may be files from other depots in the pending changelist). For example:
p4 shelve -f -d -c 399 //depotname/...
Then try deleting the changelist. For example:
p4 change -d 399
If the changelist fails to delete with the following error:
Change 399 has shelved files associated with
it and can't be deleted.
it just means there were files from other depots in the shelved changelist and no more action for this changelist is required.
3. To remove all of the files in the depot to be deleted, enter the command:
p4 obliterate -y //depotname/...
It is important to note that p4 obliterate
does not affect files in client workspaces. If a file is opened by users, then an administrator obliterates the file, the record of the file being opened is removed. The end result is as if the file had never existed; but the files in the client workspaces remain.
Note: Prior to release 2006.2, files were "snapped" automatically during obliterate, and the p4 snap command did not exist.
4. Finally, to delete the depot, run the following command:
p4 depot -d depotname
If at this point depot deletion still fails, it's possible that there are extraneous files (files not referenced by any Perforce metadata) in the archive tree for the depot being deleted. To resolve this situation:
Perforce Server 2011.1-2012.2: Temporarily rename the archive file directory and then run a p4 verify to ensure no files in the directory are required by Perforce. If the p4 verify is clean (shows no MISSING files), you can then delete the depot:
p4 depot -d depotname
and safely remove the renamed archive file directory.
Perforce Server 2013.1: Run a p4 verify to ensure no files in the directory are required by Perforce. If the p4 verify is clean (shows no MISSING files), you can then delete the depot:
p4 depot -d -f depotname