tags:

views:

85

answers:

2

Guys,

Is there a way to enable exclusive checkouts on clear case? I want that when I work on a file, no one else will be able to check it out.

TY

A: 

You just check out "reserved". Anyone else who checks out the same file will get an "unreserved" version. You will then be guaranteed the right to check in a version which creates the successor to the current version, whereas anyone else with an "unreserved" checkout will not. This is actually a much better system than exclusive checkouts.

Paul R
How is it better then exclusive checkouts?
Because if some idiot checks out a file exclusively and then forgets about it or goes away on vacation it doesn't stop other people from getting on with their work.
Paul R
What if the same idiot is checking out the file I'm working on, and remove lines of code that I need?? Then I check in my file thinking everything is good, and this idiot wants to check in his version of the file...then what happens?? Merge? assume the guy is stupid, he will do it wrong...
You would still have the same problem even if you could check out exclusively - once you've checked in your changes then "some other idiot" can still come along and mess things up. If you really just want to prevent other users form making changes then you can lock elements or even whole branches to everyone but you, or just lock them against specific users.
Paul R
Sound good. Thank you very much. I appreciate your help.
A: 

ClearCase support both:

  • "soft" pessimistic lock: checkout reserved
  • optimistic lock: (unreserved checkouts)

The advantage of checkout reserved is that it does not prevent another person to work on the same file, since he/she will have to wait for your checking before having to merge his/her work with your new version.

See about reserved/unreserved checkouts

That said, you could add a post-op trigger (post-checkout) which would check if the file has already a checkedout version and which would undo the checkout and exit with a message preventing the second user to checkout at all the same file.

cleartool mktrtype -element -all -postop checkout \
-execwin "\\path\to\checkIfNotCo.pl" \
-execunix "/path/to/checkIfNotCo.pl" \
-c "check if not CheckedOut" notco_trigger

You could still need to write the checkIfNotCo.pl, but as Paul mentions in his answer, this is not really needed.
If it is a really sensitive file, you could lock it.

VonC
Very nice! Thank you very much.