Need help with preop trigger for checkin with ClearCase

m_k_sudhir's picture
m_k_sudhir asked on January 23, 2012 - 8:09am | Replies (1).

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.

1 Answer

Yossi Zinger's picture

We have a similar trigger, only in our case we require the file to have a special 'begin' and 'end' markers (this is not a problem for us since our users have ready-made templates for the relevant file types)

The preop trigger removes anything written between these markers and writes its own data.

if the markers are missing, the trigger fails the checkin with an appropriate message to the user.

CMCrossroads is a TechWell community.

Through conferences, training, consulting, and online resources, TechWell helps you develop and deliver great software every day.