Search code examples
perforceresolvechangelist

Perforce auto resolve (on a pending changelist) from the command line?


I want to safe resolve all the files in a pending changelist.

Currently, the only way I know to do this is to pass p4 a list of files.

SET CHANGE_NUMBER=default
SET CHANGE_FILES=files.txt
DEL %CHANGE_FILES%
for /f "tokens=1 delims=#" %%a in ('p4 opened -c %CHANGE_NUMBER%') DO ECHO %%a>>%CHANGE_FILES%
p4 -x %CHANGE_FILES% resolve -as

Is it possible with a single p4 command?


Solution

  • p4 resolve can take a list of files, so I think you can write it like so (Unix-like shell syntax assumed):

    p4 resolve -as `p4 opened -c <change-number>`
    

    using the backquote syntax to insert the result of running the p4 opened command, where <change-number> is the number of your changelist.

    (If you don't have any files opened in any other changelist, then you should be able to use the simpler p4 resolve -as //...).