Removes files and their history from the depot.
p4 [g-opts] obliterate [-y -A -b -a -h] file[revRange] ...
Use p4 obliterate
with caution. This is one of only
two commands in
Perforce
that actually removes file data. (The other command that removes file
data is the archive-purging option for p4 archive
.)
The p4 obliterate
command actually deletes the
server’s copy of a file’s data, precluding any possibility of recovery.
(By contrast, the p4
delete
command merely marks the latest revision as
deleted, but leaves earlier revisions intact in the depot.)
p4 obliterate
can be used by
Perforce
administrators to permanently remove files from the depot. The file is
removed from the
Perforce
service, along with all associated metadata, including references to the
file in labels, the have list, and so on. After p4
obliterate
completes, it appears to the service as if the
affected file(s) had never existed. Copies of files in user workspaces
are left untouched, but are no longer recognized as being under
Perforce
control.
p4 obliterate
requires at least one file pattern as
an argument. To actually perform the obliteration, the -y
option is required; without it, p4 obliterate
merely
reports what it would do without actually performing the
obliteration.
If you specify a single revision (for instance, p4 obliterate
file#3
), only that revision of the file is obliterated. If
you specify a revision range (for instance, p4 obliterate
file#3,5
), only the revisions in that range are
obliterated.
p4 obliterate myfile
does not obliterate a shelve
of the file (archive or metadata). When you attempt to unshelve a file
that has been obliterated, you will get an error. To recover the
content of that file, print the file. To get rid of the shelve, delete
the shelf.
p4 obliterate
with a file spec does not obliterate a
shelve of the file.
|
Perform the obliterate operation. Without this option,
|
|
Obliterate a revision marked for archive. By default, archived revisions are skipped. |
|
Restrict files in the argument range to those that are branched,
and to files that are both the first revision and the head
revision. This option is useful for removing old branches (where
only one revision exists) while preserving files that have been
modified post-branch. You can greatly improve the performance of
|
|
Skip the (potentially resource-intensive) search of
|
|
Skip the search of |
|
See Global Options. |
Can File Arguments Use Revision Specifier? | Can File Arguments Use Revision Range? | Minimal Access Level Required |
---|---|---|
Yes |
Yes |
|
p4 obliterate
is one way to reclaim disk space
from files that are no longer required, or to clean up mistakes made by
users who create file hierarchies in the wrong place. Do not use
operating system commands (erase
,
rm
, and their equivalents) to remove files from the
Helix Core
server root by hand.p4 archive
and p4 restore
in
conjunction with an archive depot. With archive depots, file history is
preserved and available to all users, and file contents may be moved to
offline or near-line storage.Obliterating files in revision ranges can also change the behavior
of scripts, as revision numbers of files may "skip" obliterated
revisions. For instance, the output of p4 filelog
after
obliterating revisions #2
and #3
might look
like this:
... #4 change 1276 edit on 2011/04/18 by user@dev1 (binary) 'Fixed' ... #1 change 1231 add on 2011/04/12 by user@dev1 (binary) 'First try'
In this case, a developer using the #4
in the first
line of the output to assume the existence of four change
descriptions in the output of p4
filelog
would encounter difficulty.
|
Do not obliterate any files; list the files that would be
obliterated with the In this case, all files in directory |
|
Obliterate |
|
Obliterate only the third revision of
If If |
|
Obliterate revisions 3, 4, and 5 of
If If |
To mark a file deleted at its head revision but leave it in the depot. This is the normal way of deleting files. |
|
Instead of obliterating files, you can save disk space on a local depot by archiving some of its revisions to an archive depot. History of changes to these files is preserved. |
|
To restore archived revisions from an archive depot. (You cannot restore obliterated files, but you can restore archived files.) |