p4 archive

Archive obsolete revisions to an archive depot.

Syntax

p4 [g-opts] archive [-h -n -p -q -t] -D depot  FileSpec[revSpec]

Description

Moves the specified revisions into a depot of type archive.

When files are moved into an archive depot, their last action is changed to archive. Commands that access file content, such as p4 sync and p4 diff, skip archive revisions, but commands that do not require access to file content, such as p4 filelog, continue to report metadata concerning the archived revisions.

Tip

If you want to disable server locks when running the p4 archive command, set the value of the the server.locks.archive configurable to 0.

Warning

Use p4 archive -p with caution. Only two commands in Helix Server remove file data: p4 archive -p and p4 obliterate.

Options

-D depot

Specify an archive depot to which files are to be archived.

-h

Do not archive head revisions.

-n

Do not archive revisions. Instead, report on which revisions would have been archived.

-p

Purge any archives of the specified files named in the archive depot. (The action for affected revisions is set to purge on completion. File contents are no longer accessible from p4 restore.)

-q

Quiet mode, which suppresses messages about skipped revisions.

-t

Archive text files (or other revisions stored in delta format, such as files of type binary+D)

g-opts

See Global Options.

Usage Notes

Can File Arguments Use Revision Specifier? Can File Arguments Use Revision Range? Minimal Access Level Required

Yes

Yes

admin

Examples

p4 archive file#3

  • Archive revisions 1 through 3 of file
  • If a single revision is specified as a file argument, p4 archive implicitly targets revisions #1 through the specified revision for archiving

p4 archive file#3,3

  • Archive revision 3 of file
  • To archive only a single revision rev, use the form p4 archive file#rev,rev
To archive files stored in delta format, use the -t option:

p4 archive -D archives -t //depot/....txt

Use the ... wildcard to archive the files with the .txt extension.

p4 archive -D archives -t //depot/....txt@3,3

Use the ... wildcard to archive the files with the .txt extension that belong to changelist 3.

p4 archive -D archives -t //depot/....txt@3

Use the ... wildcard to archive the files with the .txt extension that belong to changelists 1 through 3.

If Helix Server must manipulate a large numbers of RCS deltas, the computational cost might be noticable.

Related Commands

To create a depot

p4 depot

To restore files from an archive depot

p4 restore

To obliterate files without archiving them

p4 obliterate