Perforce Command Reference:   [Index] [Prev] [Next]


p4 diff

Synopsis

Compare a client workspace file to a revision in the depot

Syntax

p4 [g-opts] [-dflag -f -sa -sd -se -sr] file[rev#]...]

Description

p4 diff runs a diff program on the Perforce client, comparing files in the client workspace to revisions in the depot. This command takes a file argument, which can contain a revision specifier. If a revision specifier is included, the client will be diffed against the specified revision. If a revision specifier is not included, the client workspace file will be compared against the revision currently being edited (usually the head revision). In either case, the client file must be open for edit, or the comparison must be against a revision other than the one the client file was last synced to.

If the file argument includes wildcards, all open files that match the file pattern will be diffed. If no file argument is provided, all open files will be diffed.

By default, the diff routine used is one provided with the Perforce client. You can change this diff routine to any other diff program by setting the P4DIFF environment or registry variable.

Options

-f Force the diff, even when the client file is not open for edit.
-dflag Pass flag flag to the underlying diff routine (please see the Examples below for more details)
-sa Diff only open files that are different from the revision in the depot, or are missing.
-sd Diff only files that are missing on the client.
-se Diff only unopened files that are different from the revision on the client.
-sr Diff only unopened files that are identical to the revision on the client.
g_opts See global options section.

Usage Notes

Can File Arg Use
Revision Specifier?
Can File Arg
Use Revision Range?
Minimal
Access Level Required
Yes No read

Examples

p4 diff foo#5 Compare the open client workspace revision of file foo to the fifth depot revision.
p4 diff @1999/05/22 Compare all open files in the client workspace to the revisions in the depot as of midnight on May 22, 1999.
p4 diff -du foo Run the comparison on file foo, passing the -u flag to the underlying diff routine
p4 diff -d-brief foo Run the comparison on file foo, passing the --brief flag to the underlying diff routine
p4 diff -sr | p4 -x - revert Revert all open, unchanged files. The first command lists all unchanged files; the second command reverts that list. (This is the UNIX version of this command; it uses a pipe. Most operating systems have some equivalent way of performing these operations in series).

Related Commands

To compare two depot revisions p4 diff2
To view the entire contents of a file p4 print



Perforce Command Reference:   [Index] [Prev] [Next]


Copyright 1999 Perforce Software.
Contact us at [email protected]
Last updated: 09/15/99 (Manual version 99.1.cr.6)