Previous Table of Contents Index Next
Perforce 2009.2: Command Reference



p4 annotate
Synopsis
Print file lines along with their revisions.
Syntax
p4 [g-opts] annotate [ -a -c -i -q -dflag ] file[revRange] ...
Description
The p4 annotate command displays the revision number for each line of a revision (or range of revisions) of a file (or files). You can then run p4 filelog on the indicated revision(s) to find out who made each change, when, and why.
To display the changelist number associated with each line of the file, use the -c option.
If you specify a revision number, only revisions up to that revision number are displayed. If you specify a revision range, only revisions within that range are displayed.
By default, the first line of output for each file is a header line of the form:
filename#rev - action change num (type)
where filename#rev is the file's name and revision specifier, action is the operation the file was open for: add, edit, delete, branch, or integrate, num is the number of the submitting changelist, and type of the file at the given revision.
To suppress the header line, use the -q (quiet) option.
To print all lines (including lines from deleted files and/or lines no longer present at the head revision), use the -a (all) option.
Options
If you use the -a option and the -c option together, each line includes a starting and ending changelist number.
-dflags
Runs the diff routine with one of a subset of the standard UNIX diff flags. See the Usage Notes below for a listing of these flags.
Follow file history across branches. If a file was created by branching, Perforce includes revisions up to the branch point.
The use of -i option implies the -c option.
Usage Notes
Can File Arguments Use
Revision Specifier?
The output of p4 annotate is highly amenable to scripting or other forms of automated processing.
Examples
Print all lines of file.c, each line preceded by the revision that introduced that line into the file.
Print all lines of file.c, each line preceded by the changelist number that introduced that line into the file.
Print all lines of file.c, including deleted lines, each line preceded by a revision range.
Print all lines of file.c, including deleted lines, each line preceded by a range of changelists.
 


Previous Table of Contents Index Next

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