Perforce 2001.1 User's Guide | ||
<< Previous Chapter Job Tracking |
Table of Contents Index Perforce on the Web |
Next Chapter >> Installing Perforce |
Many of the reporting commands have numerous options, but discussion of all options for each command is beyond the scope of this manual. For a full description of any particular command, please consult the Perforce Command Reference, or type p4 help command at the command line.
One previously mentioned note on syntax is worth repeating here: any filespec argument in Perforce commands, as in:
p4 files filespec
will match any file pattern that is supplied in local syntax, depot syntax, or client syntax, with any Perforce wildcards. Brackets around [filespec] mean that the file specification is optional. Additionally, many of the reporting commands can take revision specifiers as part of the filespec. Revision specifiers are discussed on "Specifying Older File Revisions" on page 46.
//depot/README#5 - edit change 6 (text)
The p4 files command requires one or more filespec arguments. Filespec arguments can, as always, be provided in Perforce or local syntax, but the output always reports on the corresponding files within the depot. If you don't provide a revision number, Perforce uses the head revision.
Unlike most other commands, p4 files also describes deleted revisions, rather than suppressing information about deleted files.
The output of p4 filelog has this form:
For each file that matches the filespec argument, the complete list of file revisions is presented, along with the number of the changelist that the revision was submitted in, the date of submission, the user who submitted the revision, the file's type at that revision, and the first few characters of the changelist description. With the -l flag, the entire description of each changelist is printed:
#3 change 23 edit on 1997/09/26 by edk@doc |
//depot/elm_proj/README - edit default change (text)
Each opened file is described by its depot name and location, the operation that the file is opened for (add, edit, delete, branch, or integrate), which changelist the file is included in, and the file's type.
All these commands can be used with or without filespec arguments. p4 sync -n is the only command in this set that allows revision specifications on the filespec arguments.
The output of p4 where filename looks like this:
//depot/elm_proj/doc/Ref.guide //edk/doc/Ref.guide /usr/edk/doc/Ref.guide
The first part of the output is the location of the file in depot syntax; the second part is the location of the same file in client syntax, and the third is the location of the file in local OS syntax.
p4 have's output has this form:
//depot/doc/Ref.txt#3 - /usr/edk/elm/doc/Ref.txt
and p4 sync -n provides output like:
//depot/doc/Ref.txt#3 - updating /usr/edk/elm/doc/Ref.txt
The following table lists other useful commands:
//depot/elm_proj/README#23 - edit change 50 (text)
p4 print takes a mandatory file argument, which can include a revision specification. If a revision is specified, the file is printed at the specified revision; if no revision is specified, the head revision is printed.
The p4 diff command has many options available; only a few are described in the table below. For more details, please consult the Perforce Command Reference.
Whereas p4 diff compares a client workspace file against depot file revisions, p4 diff2 can be used to compare any two revisions of a file. It can even be used to compare revisions of different files. p4 diff2 takes two file arguments -- wildcards are allowed, but any wildcards in the first file argument must be matched with a corresponding wildcard in the second. This makes it possible to compare entire trees of files.
There are many more flags to p4 diff than described below. For a full listing, please type p4 help diff at the command line, or consult the Perforce Command Reference.
The last example above bears further explanation; to understand how this works, it is necessary to discuss how Perforce implements and calls underlying diff routines.
Perforce uses two separate diffs: one is built into the p4d server, and the other is used by the p4 client. Both diffs contain identical, proprietary code, but are used by separate sets of commands. The client diff is used by p4 diff and p4 resolve, and the server diff is used by p4 describe, p4 diff2, and p4 submit.
Perforce's built-in diff routine allows three -d<flag> flags: -du, -dc, and -dn. Both p4 diff and p4 diff2 allow any of these flags to be specified. These flags behave identically to the corresponding flags in the standard UNIX diff.
Although the server must always use Perforce's internal diff routine, the client diff can be set to any external diff program by pointing the P4DIFF environment variable to the full path name of the desired executable. Any flags used by the external diff can be passed to it with p4 diff's -d flag. Flags are passed to the underlying diff according to the following rules:
If you want to pass the following flag to an external client diff program: |
Then call p4 diff this way: |
---|---|
-u |
p4 diff -du |
--brief |
p4 diff -d-brief |
-C 25 |
p4 diff -d'C 25' |
Change 36 on 1997/09/29 by edk@eds_elm 'Changed filtering me' |
By default, p4 changes displays an aggregate report containing one line for every changelist known to the system, but command line flags and arguments can be used to limit the changelists displayed to those of a particular status, those affecting a particular file, or the last n changelists.
Currently, the output can't be restricted to changelists submitted by particular users, although you can write simple shell or Perl scripts to implement this (you'll find an example of such a script in the Perforce System Administrator's Guide).
Note |
For details about Perforce commands that allow you to use revision ranges with file specifications, see "Revision Ranges" on page 49. |
The output of p4 describe looks like this:
This output is quite lengthy, but a shortened form that eliminates the diffs can be generated with p4 describe -s changenum.
For more commands that report on jobs, see "Job Reporting" on page 122.
The other label reporting commands are variations of commands we've seen earlier.
The table below describes the most commonly used commands for branch- and integration-related reporting.
job000302 on 1997/08/13 by saram *open* 'FROM: headers no' |
Its output includes the job's name, date entered, job owner, status, and the first 31 characters of the job description.
All jobs known to the system are displayed unless command-line options are supplied. These options are described in the table below.
To See a List of Jobs: |
Use This Command: |
---|---|
...including all jobs known to the server |
p4 jobs |
...including the full texts of the job descriptions |
p4 jobs -l |
...for which certain fields contain particular values (For more about jobviews, see "Viewing jobs by content with jobviews" on page 106) |
p4 jobs -e jobview |
...that have been fixed by changelists that contain specific files |
p4 jobs filespec |
...that have been fixed by changelists that contain specific files, including changelists that contain files that were later integrated into the specified files |
p4 jobs -i filespec |
The output of p4 fixes looks like this:
job000302 fixed by change 634 on 1997/09/01 by edk@eds_elm |
A number of options allow the reporting of only those changes that fix a particular job, jobs fixed by a particular changelist, or jobs fixed by changelists that are linked to particular files.
A fixed job will not necessarily have a status of closed job, since open jobs can be linked to pending changelists, and pending jobs can be reopened even after the associated changelist has been submitted. To list jobs with a particular status, use p4 jobs.
p4 users generates its data as follows:
Each line includes a username, an email address, the user's "real" name, and the date that Perforce was last accessed by that user.
To report on client workspaces, use p4 clients:
Client eds_elm 1997/09/12 root /usr/edk 'Ed's Elm workspace' |
Each line includes the client name, the date the client was last updated, the client root, and the description of the client.
Depots can be reported with p4 depots. All depots known to the system are reported on; the described fields include the depot's name, its creation date, its type (local or remote), its IP address (if remote), the mapping to the local depot, and the system administrator's description of the depot.
The use of multiple depots on a single Perforce server is discussed in the Perforce System Administrator's Guide.
The -o flag is available with most of the Perforce commands that normally bring up forms for editing. This flag tells these commands to write the form information to standard output, instead of bringing the definition into the user's editor. This flag is supported by the following commands:
The -n flag prevents commands from doing their job. Instead, the commands simply tell you what they would ordinarily do. You can use the -n flag with the following commands
In the following example, main represents the main codeline, and r3.2 is a codeline that was originally branched from main:
p4 changes //depot/main/... > changes-in-main |
You can use this to uncover which changes have been made to r98.4 that haven't been integrated back into main.
When this script is called with a username as an argument, only those changes created by that user will be printed.
These scripting examples are non-exhaustive. You can use scripts whenever you want to generate reports that aren't already built into the existing Perforce commands.
Perforce 2001.1 User's Guide | ||
<< Previous Chapter Job Tracking |
Table of Contents Index Perforce on the Web |
Next Chapter >> Installing Perforce |