Resolving Files

Conflicts occur when you attempt to merge a file into an existing codeline or submit a changelist containing a file that another user has edited and submitted while you had the file checked out. When the conflict occurs, Perforce schedules the file for resolve. Conflicts must be resolved before you can submit the changelist that contains the conflicting file. To indicate a file that needs resolving, P4V displays a question mark badge.

When you attempt to submit a changelist containing a file that must be resolved, the Submit Changelist form displays instructions and the Submit button is grayed out. If the dialog says Out of date and there is a yellow triangle badge on any file, get the latest revision of that file by context-clicking it and selecting Get Latest Revision. This will not overwrite the copy of the file that is in your workspace. After you have the latest revision, you can resolve the file. You can resolve files individually or attempt to resolve multiple files at once.

You can resolve conflicts resulting from content changes, filetype changes, attribute changes, moves, deletes, and branching.

Resolve individual files

To resolve an individual file:

  1. Context-click the file and select Resolve....

  2. The Resolve dialog opens in interactive mode by default.

    If the file requires multiple resolve types (if, for example, another user has checked in changes to both the content and filetype since you checked the file out), you can select Auto resolve multiple files, but the default is to Interactively resolve files one at a time. In this case, each resolve type is listed as a separate row in the Files to resolve list.

    For each file/resolve-type combination, P4V recommends an action, based on the differences and conflicts in the file selected. This recommendation is followed by an explanation. The action button for the option is highlighted in blue.

  3. (Optional) For more information about the files being resolved, select an option from the list of Additional Actions:

    • Open File: Enables you to open either version of the file individually or the merged result file in any editor.

    • Diff: Enables you to diff the files with each other, with the base file, or with the merged result.

    • File History: Displays the revision history of either file.

    • Time-lapse View: Displays the history of either file using the Time-lapse View tool.

    • Revision Graph: Displays the codeline history of either file using the Revision Graph tool.

  4. Select whether to Merge binary files as text when resolving content.

    If you select this option, P4V treats binary files like text files and attempts a textual merge between the source and target files.

  5. Follow the recommended action (highlighted in blue), or select another resolve option:

    • Accept Source: Replaces the copy of the file in your workspace with the version that is in the depot, discarding your changes.

    • Accept Target: Accepts the file that is in your workspace, overwriting the version that is in the depot when you submit the file.

    • Accept Merged: Replaces the file in your workspace with the merged result of the two files listed in the box at the top of the screen.

    • Run Merge Tool: Open the merge tool to edit the file and save the merged result (P4Merge is the default merge tool, but you may have chosen another tool in P4V Preferences).

    As each file is resolved, it is removed from the list of Files to resolve.

  6. To check in the changes, submit the changelist that includes the resolved files.

Resolve multiple files

To resolve multiple files at once, automatically:

  1. Select the files, context-click, and select Resolve....

  2. Select Auto resolve multiple files.

    The Resolve dialog displays the Files to Resolve. As files are resolved, they are removed from this list.

    To limit the files being auto-resolved to a particular resolve type or file type, select the type from the Select drop-down. This can be helpful when different resolve types might require different auto-resolve actions, or when some resolve or file types require you to resolve them interactively. For example, if your list of files to resolve includes both binary and text files, you might select the text files for auto resolve and leave the binaries to be resolved interactively.

    The dialog displays the number of selected rows immediately above the list.

  3. Select whether to Merge binary files as text when resolving content.

    If you select this option, P4V treats binary files like text files and attempts a textual merge between the source and target files.

  4. Select a Resolve method:

    • Safe automatic resolve (no merging): Accepts the source file (the file in the depot) if it has the only changes. Accepts the target file (the file in your workspace) if it has the only changes. Doesn't resolve if both the source and target have changed.

    • Automatic resolve (allow merging): Accepts the source if it has the only changes. Accepts the target file if it has the only changes. Merges changes if both the source and target have changed and there are no conflicts.

    • Accept Source: Replaces the copy of the file in your workspace with the version that is in the depot, discarding your changes.

    • Accept Target: Accepts the file that is in your workspace, overwriting the version that is in the depot when you submit the file.

    • Automatic resolve (allow merging with conflicts): Accepts the source if it has the only changes. Accepts the target file if it has the only changes. Creates a merged file if both the source and target have changed, even if there are conflicts. Where there are conflicts, both versions are included with text notations indicating the conflicts.

  5. (Optional) Select Set as Auto Default to set your selections as the default for auto-resolving multiple files.

  6. Click Auto Resolve.

    If you selected an auto resolve option that does not allow merges when there are conflicts, any conflicts will prompt P4V to recommend that you resolve the files interactively one at a time.

  7. (Optional) Repeat if you are auto-resolving multiple resolve types separately.

  8. To check in the changes, submit the changelist that includes the resolved files.

To resolve multiple files one at a time (recommended when there are conflicts):

  1. Select Interactively resolve files one at a time.

  2. Follow the procedure described in Resolve individual files.