Previous Table of Contents Index Next
Perforce 2009.1: Command Reference



p4 print
Synopsis
Print the contents of a depot file revision.
Syntax
p4 [g-opts] print [ -a ] [ -o outfile ] [ -q ] file[revRange] ...
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.)
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) flag.
Multiple file patterns can be included; all files matching any of the patterns are printed.
Options
For each file, print all revisions within a specified revision range, rather than only the highest revision in the range.
-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.
Usage Notes
Can File Arguments Use
Revision Specifier?
p4 print's file arguments can take a revision range. By default, only the highest revision matched by any particular file is printed (that is, when no range is specified, the implied range is #1,#head, and the highest revision is #head). To print all files in a specified (or implied) range, use the -a option.
Because p4 print's output can be quite large when called with highly non-restrictive file arguments (for instance, p4 print //depot/... prints the contents of all files in the depot), it may be subject to a maxresults limitation as set in p4 group.
In many cases, redirecting p4 print's output to a file via your OS shell will suffice.
The -o option is intended for users who require the automatic setting of file type and/or permission bits. This is handy for files such as UNIX symbolic links (stored as type symlink), files of type apple, automatically setting the execute bit on UNIX shell scripts stored as type text+x, and so on.
Related Commands
 


Previous Table of Contents Index Next

Perforce 2009.1: Command Reference
Copyright 1999-2009 Perforce Software.