13

P4V has been crapping out on me when attempting to resolve a large number of files as part of an integration. I want to be able to do this in the command line.

Here's the steps in P4V:

  1. Right-click the CL.
  2. Choose "Resolve Files..." A dialog will appear.
  3. Choose "Merge yours and theirs if no conflicts exist".
  4. Click Auto.

Can someone translate this into a p4 command line command with correct arguments?

Fostah
  • 10,330
  • 9
  • 44
  • 55

3 Answers3

13

You can use p4 resolve -am [file ...] which will skip the files with conflicts.

If you specify a file, you will work on that file only. If you specify ..., you will work on files below your working directory. If you do not specify a file, it will work on all of the files in your workspace.

akf
  • 36,245
  • 8
  • 81
  • 94
  • It's not possible to specify a Pending CL for the files with the resolve command? – Fostah Jul 27 '09 at 14:55
  • 4
    No, it doesnt seem so. One option is to wrap it in a `for` loop in a batch, taking the changelist from the command line and iterating over the files returned by `p4 describe changelist#`, passing them to `p4 resolve -am` – akf Jul 27 '09 at 15:23
  • I'd rather use `p4 resolve -as`. As it only resolves if it's safe to do so. The `-am` option merges too, which may cause merge errors, I'd rather do that manually in p4merge. – Calmarius Jun 27 '16 at 10:49
  • is there a way to do this but when there is actual conflict - open p4 UI same way as without -am option? I'd like to integrate this tool with my git workflow. Currently I have to close-save all the conflicts if P4 thinkgs there is no conflict. But if I specify -am this means, I will not see any UI in case of conflict either... – Dmitry Gusarov Mar 20 '20 at 17:17
8

I do not have enough reputation to add a comment to the accepted answer so I'll add information in a new answer.

With Perforce 2013.2 you can indeed provide a changelist number to resolve to limit the operation to the files in that changelist.

p4 resolve -c changelist#
DeQuimet
  • 126
  • 1
  • 3
0

I follow these steps, to do it from command line.

  1. In perforce client, Select the folder in workspace.
  2. Select File -> Open Terminal Window Here.Terminal will open in the same directory which is selcted in step 1.
  3. Perform a dry run using option -n :

p4 resolve -c 1234 -n

  1. To accept automatic merge from perforce use -am option, Automatic Mode. Automatically accept the 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.

p4 resolve -c 1234 -am

Eklavyaa
  • 198
  • 3
  • 14