I am working on a batch process to update the client workspace and it might happen that this leads to a conflict due to opened files in the client workspace:
D:\perforce\project>p4 sync D:\perforce\project\...@12345
could lead to:
//server/project/inc/test.h#106 - is opened and not being changed ... //server/project/inc/test.h - must resolve #106 before submitting
How can I detect this before/after the batch job without parsing the p4 output of the sync operation?
Any solution is going to involve running a command and interpreting its output.
To detect before the fact that files are open (which means that sync will not be able to update those files and/or may schedule resolve operations), use the p4 opened
command, e.g.:
p4 opened D:\perforce\project\...
To specifically get information about what the sync will do (will it schedule resolves or will it just skip the files because they're already opened at a revision greater than 12345?), do sync -n
:
p4 sync -n D:\perforce\project/...@12345
To discover after the fact whether there are any pending resolve operations, do p4 resolve -n
:
p4 resolve -n
OR: p4 resolve -n D:\perforce\project\... (to limit the scope to that directory)