I am working on a pre-op trigger for the checkin process, where I am adding a line which contains the following information in the file to be checked in:
1. Version number
2. Username
3. Date
4. Comment entered by user during checkin
The above values are being read from clearcase environment variables.
I am implementing this using Perl. The problem I am facing is in case of a failed checkin( for example, an unreserved checkout user trying to checkin the file, when another user has checked out the file in reserved mode).
Since this is a preop trigger, even if the checkin fails, the script will run and the line is getting added in the file.
Currently, I have implemented a temporary workaround for this: before adding the line in the file, I check whether a similar line (comparing until version number, username, date) already exists in the file. If it exists, I am displaying error message to the user and checkin process will fail. The user has to manually delete the line from the file and try to checkin again.
Now I am looking for a solution where I can determine a failed checkin well in advance, so that the line does not get added at all in the file.
If you have implemented a trigger similar to this one, please share your ideas and help me out.