Perforce 2000.1 Command Line User's Guide (2000.1.ug.3) | ||
<< Previous Chapter Job Tracking |
Table of Contents Index Perforce on the Web |
Next Chapter >> Installing Perforce |
Many of the reporting commands have numerous options; 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] means 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 "How to Specify Older File Revisions" on page 35.
//depot/README#5 - edit change 6 (text)
p4 files requires one or more filespec arguments. Filespec arguments can, as always, be provided in Perforce or local syntax, but the output will always report the corresponding files within the depot. If you don't provide a revision number , Perforce will use the head revision.
Unlike most other commands, p4 files will describe deleted revisions, instead of 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; The file will be printed at the specified revision; if no revision is specified, the head revision will be 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 are 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, or 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 |
There aren't many Perforce commands that allow you to use revision ranges with file specifications. Please see "Revision Ranges" on page 37 for details on revision ranges. |
The output of p4 describe looks like this:
This output is quite lengthy; 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 89.
The other label reporting commands are variations of commands we've seen earlier.
job000302 on 1997/08/13 by saram *open* 'FROM: headers no' |
Its output includes the jobs name, date entered, job owner, and the first 32 characters of the job description. The job status is included if the job is open or suspended; closed jobs are indicated by the absence of job status from the report.
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 77.) |
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 |
job000302 fixed by change 634 on 1997/09/01 by edk@eds_mach |
A number of options allow the reporting of only those changes that fix a particular job, or 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 will 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 (of course!) non-exhaustive. You can use scripts whenever you want to generate reports that aren't already built into the existing Perforce commands.
Perforce 2000.1 Command Line User's Guide (2000.1.ug.3) | ||
<< Previous Chapter Job Tracking |
Table of Contents Index Perforce on the Web |
Next Chapter >> Installing Perforce |