Search code examples
version-controlclearcase

ClearCase: How to create branch with branch type


I'm trying to use mkbranch command to create branch from main/abc branch.

I create branch type with following command:

mkbrtype –c "bugfix branch from abc" bugfixAbc

Now I need to create branch with that branch type.

How I'll create new branch from main/abc branch with branch type bugfixAbc?


Solution

  • You need to modify your config spec in order to create new versions starting from abc. see for example "Where do new elements appear when mkelem is used?":

    element * CHECKEDOUT
    element * .../bugfixAbc/LATEST
    element * .../abc -mkbranch(bugfixAbc)
    element * /main/0 -mkbranch(bugfixAbc)
    element * /main/LATEST
    

    The ellipsis .../ in a selection rule allows for ClearCase to select that branch abc, from whatever branch it comes from: /main, or any other branch.

    Using cleartool mkbranch is not the solution here: it won't scale if you have to do it for many files, and it creates a version 0 left in checked-out state, that you should checkin. (or cancel the checkout, which would delete the branch)

    By using a config spec, you will create automatically that branch each time you checkout an element present in the abc branch. Any element, not just a given file.