p4 print

Print the contents of a depot file revision.

Syntax

p4 [g-opts] print [-a -A -k -q] [-m max] [-o outfile] file[revRange] ...
p4 [g-opts] print -U unloadfile ...

Description

The p4 print command writes the contents of a depot file to standard output. A revision range can be included; in this case, only the files with revisions in the specified range are printed, and by default, only the highest revision in that range is listed. (To output each file at every revision within a specified revision range, use p4 print -a.) Multiple file patterns can be included; all files matching any of the patterns are printed.

Any file in the depot can be printed, subject to permission limitations as granted by p4 protect. If the file argument does not map through the client view, you must provide it in depot syntax.

By default, the file is written with a header that describes the location of the file in the depot, the revision number of the printed file, and the number of the changelist that the revision was submitted under. To suppress the header, use the -q (quiet) option.

By default, RCS keywords are expanded. To suppress keyword expansion, use the -k (keyword) option.

By default, the local depot is searched for the specified file. If you specify the -U option, the unload depot is searched instead.

Options

-a

For each file, print all revisions within a specified revision range, rather than only the highest revision in the range.

-A

Attempt to print a file stored in an archive depot.

-k

Suppress RCS keyword expansion.

-m max

Print only the first max files.

-o outfile

Redirect output to the specified output file on the local disk, preserving the same file type, attributes, and/or permission bits as the original file in the depot.

-q

Suppress the one-line file header normally added by Perforce.

-U

Look for the specified file or files in the unload depot. Data about an unloaded client, label, or task stream can be printed.

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

read

Related Commands

To compare the contents of two depot file revisions

p4 diff2

To compare the contents of an opened file in the client workspace to a depot file revision

p4 diff