ClearCase - How lock a file only on a specific branch

367 Views Asked by At

Can someone to point me to lock a file only on a specific branch in clearcase? Note that i want the same file to be modified in all other branches that other teams working on...

Locking the branches as appropriate might help.But it does not sound like a good idea. Please share your thoughts.

2

There are 2 best solutions below

0
On

This wouldn't be a simple clearool lock, as it would lock the element for all branches.

A simple approach would be a cleartool checkout -reserved, but that owuld prevent checking on other branches as well.

That leaves you with a preop checkout trigger, using the trigger environment variables CLEARCASE_BRTYPE :

cleartool mktrtype -c "Prevent checkout on a branch" -element -all -preop checkout -execwin "ccperl \\shared\path\to\triggers\lock_on_branch.bat" LOCK_ON_BRANCH

The script will use:

 CLEARCASE_XPN

(All operations; element triggers only) Same as CLEARCASE_ID_STR, but prepended with CLEARCASE_PN and CLEARCASE_XN_SFX values, to form a complete VOB-extended path name of the object involved in the operation.

CLEARCASE_BRTYPE

(All operations that can be restricted by branch type) Branch type involved in the operation that caused the trigger to fire. In a rename operation, the old name of the renamed branch type object.

0
On

You can lock a specific branch instance.

cleartool lock co.exe@@/main/foo

Locks that branch instance and will block anyone from modifying that branch while allowing all other instances -- like ci.exe@@/main/foo/2 to be checked out and used.

Depending on your view setup, you may have to use lsvtree or cleartool find to find all the branch instances.