You want to write a content change trigger. These triggers are triggered after the files are transferred to the server, but before they are bound to the database. According to perforce documentation, you can use a command similar to the following
p4 diff //depot/path/...@=<change>
In the content change trigger @ = (where the change is the change list number sent to the trigger), you will receive the contents of the files that were sent. If you are looking for a way to check the server version, you can do something like
p4 diff -sr //...@=<change>
The -sr command will report files that open and match the contents of the current storage. Since the files have not yet been committed, Iโm going to assume that you really get the list of files whose contents were transferred to the server, the same as the current version of the chapter in the repository. If p4 diff -sr returns any files that are the same, return a non-zero exit code and the feed will stop and the user will have to manually return their immutable files.
I donโt think you want to actually change the contents of the change list by making a return for it. That sounds too dangerous.
Please note that you can write your trigger in any language that makes sense (as the previous poster suggested). I really think that such a trigger would be quite heavy. You will, in effect, apply diff for all content presented to all users to take one step of the developer in the queue. This may be a good price to pay, but depending on the number of users and the size of their change lists (and files), this type of trigger can take a long time.
Mark
source share