Open topic with navigation
Comparing files using diff
You can compare file revisions using the diff tool associated with
P4VS. The default
diff tool is P4Merge, which is included with
P4V. To associate a
different diff tool, go to Tools > Options > Source Control >
Perforce
- Diff/Merge. For more information, see
Setting P4VS preferences.
To diff two files or file revisions:
-
In the Solution Explorer, Submitted tool window, Submit
Changelist dialog, Pending tool window, or Pending
Changelists dialog, right-click the file whose revisions you
want to diff.
You can also diff two file revisions from the File History
tool window by dragging one revision row onto another.
-
Select one of the following:
- Diff > Diff Against…​: compare any two files or
revisions of a file.
- Diff > Diff Against Have Revision: compare the file
version in your workspace against the depot revision that you
retrieved most recently. This selection opens P4Merge (or your
preferred diff tool, if it is not P4Merge) without first opening
the Diff dialog.
- Diff Against Previous Revision (from Submitted tool
window only): compare the revision you selected against the version
in the previous changelist. This selection opens P4Merge (or your
preferred diff tool, if it is not P4Merge) without first opening
the Diff dialog.
-
In the Diff dialog, specify the revisions of the files you
want to diff:
- Path: the two files you want to diff. If you choose
Workspace version on local disk, you can ensure that all
files in the workspace (including files within the client mapping
that are not under
Helix Server
control) are displayed by using local syntax. To display only files
under
Helix Server
control, use depot syntax
- Workspace version on local disk: the file revision in your
client workspace, including any changes you made after retrieving
it from the depot and editing it.
- Latest revision: the revision that was most recently
submitted to the depot (the head revision).
- Have revision: the revision you most recently retrieved.
Does not include any edits you made after retrieving it from the
depot.
- Specify revision: enables you to designate the desired
revision using a revision number, changelist number, date, label,
or workspace.
- Click Diff.
P4VS
launches P4Merge (or your preferred diff tool, if it is not P4Merge),
displaying the differences between the files at the specified
revision.
For more information about diffing files with P4Merge, see the P4Merge
help.