Print file lines along with their revisions.
By default, p4 annotate
ignores changes to text
files over 10 MB in length.
Perforce
superusers can override this limit by setting the
dm.annotate.maxsize
configurable.
p4 [g-opts] annotate [-a -c -i -I -q -t -u -T] [-doptions] file[revRange] ...
The p4 annotate
command displays the revision number
for each line of a revision (or range of revisions) of a file (or files).
Using the -u
option displays the name of the user who
modified the change and the date when the modification occurred. If you
also want to know why the modification happened, you can use the p4 filelog
command on the
indicated revision(s).
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
is the file’s name and revision specifier, action is the operation
the file was open for: filename
#rev
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.
The output of p4 annotate
is highly amenable to
scripting or other forms of automated processing.
Here is a sample of the p4 annotate
output with the
-u
option. The first column specifies the revision number;
the second column, the name of the user; the third column, the modify
date; the fourth column, the revised line.
320: samwise 2013/05/06 sr->w.digest.Clear(); 172: markm 2004/10/27 sr->w.size.Unknown(); 169: seiwald 2004/04/21 sr->w.traitLot.Clear(); 196: anton 2006/06/12 sr->w.tampered.Clear();
Using tagged output with the -u
option, adds three lines:
one for the user, one for the time, and one for the client workspace.
... upper 962279 ... lower 961206 ... user samwise ... time 2011/03/09 11:57:14 ... client samwise-silver ... data else
Note the upper and lower entries in the tagged output. For
-a
output, these indicate the revision range where the given
line appears; for -c
output, these indicate the changelist
range where the given line appears.
|
All lines, including deleted lines and lines no longer present at the head revision, are included. Each line includes a starting and ending revision. |
|
Display the changelist number, rather than the revision number, associated with each line. If you use the |
|
Runs the diff routine with one of a subset of the standard UNIX diff options. See Usage Notes for a listing of these options. |
|
Follow file history across branches. If a file was created by branching, Perforce includes revisions up to the branch point. The use of the |
|
Follow integrations into the file. If a line was introduced into the file by a merge, the source of the merge is indicated as the changelist that introduced the line. If that source was itself the result of an integration, that source will be used instead, and so on. The use of the |
|
Quiet mode; suppress the one-line header for each file. |
|
Force |
|
Display the name of the user who modified the change and the date when the modification occurred. |
|
Align output to a tab stop of 8. You can specify a different tab value using the
|
|
See Global Options. |
Can File Arguments Use Revision Specifier? | Can File Arguments Use Revision Range? | Minimal Access Level Required |
---|---|---|
Yes |
Yes |
|
The diff options supported by p4 annotate
are
described in the following table:
Option | Name |
---|---|
|
ignore changes made within whitespace |
|
ignore line endings |
|
ignore whitespace altogether |
|
Print all lines of |
|
Print all lines of |
|
Print all lines of The starting and ending revision for each line are included. |
|
Print all lines of The starting and ending changelists for which each line exists in the file are included. |