Search code examples
clearcase

Clearcase trigger on checkin and mkelem


In our VOB we have a ClearCase trigger that doesn't allow checkin and mkelem actions without comments, but checkout comments are optional. Our SCM guys are OK with not having checkout comments, but want to enforce checkin comments.

The issue is that mkelem usually doesn't do checkins, so I'd expect a ct mkelem foo to be allowed, since this would only create version /main/0 and check it out. Only when doing ct mkeleme -c "some_comment" -ci foo would a checkin happen and the comment would be used for the newly created version /main/1.

Is it possible to implement a trigger so that it checks if an mkelem was started with -ci? This would be more homogeneous and would fulfill the policy that only checkin comments are mandatory.


Solution

  • Looking at the "Trigger Environment Variables" section of cleartool mktrtype, you should be able to query the value of the EV (Environment Variable) CLEARCASE_COMMENT.

    That way, you know if your command was launched with -c or not, and is probably used for your current pre-op checkin trigger.

    But for mkelem, there is no clear indicator of a -ci, except that it will trigger a checkin.
    So maybe it is easier to rely on your existing pre-op checkin: if the mkelem does not use -ci, the lack of comment does not matter. And it is uses -ci, the lack of comment will be caught by the pre-op checkin trigger.