Search code examples
version-controlclearcase

Which config spec is correct in the below 2 and why?


element * CHECKEDOUT
element    /test_ari/karthik/desk.txt  /main/LATEST -mkbranch karthik_9
element  /test_ari/karthik/desk.txt .../karthik_9/LATEST 
element * /main/LATEST

Why it says error for the first time when I do check out with these config spec.
But it works second time when I do check out again but with a message box saying auto branch and selected branch.
I have created a branch on main Latest version and I made it on karthik_9 LATEST so it should be working.
Yes it is working but the question why not for the first time itself.
And see the below config spec

element * CHECKEDOUT
element  /test_ari/karthik/desk.txt .../karthik_9/LATEST 
element    /test_ari/karthik/desk.txt  /main/LATEST -mkbranch karthik_9
element * /main/LATEST

These time it works with no errors or prompts.
To my knowledge it should point an error because there is no branch existing for the second line when we say karthik_9/LATEST but rather it creates the branch what we mentioned in third line and jumps to that.
So the question is does it execute the config spec rule in the top to bottom or bottom to top. If it is top to bottom why it is not showing an error in the second code but showing an error in first one. And also let me know these why we always should use:

element */main/LATEST

as the last command? Any specific reason?


Solution

  • The second one should be used when working with branch:

    • first you select version on the branch you want to create
    • then, if there is no branch yet, you select the right version from which you want to create a branch.

    The reason is as always related to the order used by ClearCase to apply a selection rule: you need first to select the version of the branch if it exists, and if not to select the version from which you start a branch.
    Should you inverse it, the version selected would always by the one from /main, even after a checkout/checkin in a new branch.