Ankit Kumar Singhal Ankit Kumar Singhal - 22 days ago 6
Java Question

how to take diff of two versions of perforce depot file

how to check if the file content is same as the revision in server perforce JAVA API. Before updating any file into perforce depot, I want to check is there any difference in content of local file and the depot file. if there is no difference then ignore to submit that file.

Answer

I think you want the getDiffFiles() method:

https://www.perforce.com/perforce/r15.1/manuals/p4java-javadoc/com/perforce/p4java/impl/mapbased/client/Client.html#getDiffFiles

Alternatively, for the specific thing you're doing (not submitting unchanged files), just use the "leaveUnchanged" submit option rather than doing the same work yourself.