Use p4 resolve to combine the contents of two files or file revisions into a single file revision. Two situations require the use of
p4 resolve before a file can be submitted:
For example, Alice does a p4 sync followed by a
p4 edit of file
file.c, and Bob does the same thing. Alice
p4 submits
file.c, and then Bob tries to submit
file.c. Bob's submit fails because if his version of
file.c were to be accepted into the depot, Alice's changes to
file.c would no longer be visible. Bob must resolve the conflict before he can submit the file.
The primary difference between these two cases is that resolving a simple file conflict involves multiple revisions of a single file, but resolving for integration involves combining two separate files. In either case:
The p4 resolve dialog refers to four file revisions whose meaning depends on whether or not the resolution fixes a simple file conflict or is resolving for integration:
The interactive p4 resolve dialog presents the following options. Note that the dialog options are not the same as the command line flags.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Edit the revision in the depot that the client revision conflicts with (usually the head revision). This edit is read-only.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
To use this option, you must set the environment variable P4MERGE to the name of a third-party program that merges the first three files and writes the fourth as a result. This command has no effect if P4MERGE is not set.
|
|
|
|
|
|
|
|
|
|
|
|
Accept yours, ignoring changes that may have been made in theirs.
|
|
|
|
Accept theirs into the client workspace as the resolved revision. The revision ( yours) that was in the client workspace is overwritten.
When resolving simple conflicts, this option is identical to performing p4 revert on the client workspace file. When resolving for integrate, this copies the source file to the target file.
|
|
|
|
Accept the merged file into the client workspace as the resolved revision without any modification. The revision ( yours) originally in the client workspace is overwritten.
|
|
|
|
If you edited the file (i.e., by selecting "e" from the p4 resolve dialog), accept the edited version into the client workspace. The revision ( yours) originally in the client workspace is overwritten.
|
|
|
|
•
|
if theirs is identical to base, accept yours;
|
•
|
if yours is identical to base, accept theirs;
|
•
|
if yours and theirs are different from base, and there are no conflicts between yours and theirs; accept merge;
|
|
|
Resolution of a file is completed when any of the accept dialog options are chosen. To resolve the file later or to revert the change,
skip the file.
If there are conflicting chunks, the merge file must be edited. In this case, Perforce will include the conflicting
yours,
theirs, and
base text in the
merge file; it's up to you to choose which version of the chunk you want to keep.
|
•
|
-am: Automatic Mode. Automatically accept the Perforce-recommended file revision: if theirs is identical to base, accept yours; if yours is identical to base, accept theirs; if yours and theirs are different from base, and there are no conflicts between yours and theirs; accept merge; otherwise, there are conflicts between yours and theirs, so skip this file.
|
•
|
-ay: Accept Yours, ignore theirs.
|
•
|
-at: Accept Theirs. Use this flag with caution, as the file in the client workspace will be overwritten!
|
•
|
-as: Safe Accept. If either yours or theirs is different from base, (and the changes are in common) accept that revision. If both are different from base, skip this file.
|
•
|
-af: Force Accept. Accept the merge file no matter what. If the merge file has conflict markers, they will be left in, and you'll need to remove them by editing the file.
|
|
|
When merging files, ignore specified differences in whitespace or line-ending convention. (If you use these flags, and the files differ by whitespace only, p4 resolve uses the text in the client file.)
•
|
-db: Ignore whitespace-only changes (for instance, a tab replaced by eight spaces)
|
•
|
-dw: Ignore whitespace altogether (for instance, deletion of tabs or other whitespace)
|
•
|
-dl: Ignore differences in line-ending convention
|
|
|
|
|
|
|
|
|
Force a three-way merge, even on binary (non-text) files. This allows you to inspect diffs between files of any type, and lets you merge non-text files if P4MERGE is set to a utility that can do such a thing.
|
|
Include conflict markers in the file for all changes between yours and base, and between theirs and base. Normally, conflict markers are included only when yours and theirs conflict.
|
|
|