Assigning branch mastership during element creation

By default, when you create an element in a replicated VOB, mastership of the branch main for that element is assigned to the replica that masters the branch type main. You can override this default behavior by explicitly assigning mastership of the main branch when you create the element.

About this task

If this replica is not your current replica, you cannot create new versions on the main branch. Also, if your config spec contains mkbranch rules and your current replica does not master the branch types, the branches cannot be created during element creation.

To assign mastership of a new element’s main branch, and all other branches created during element creation, to your current replica, do one of the following things:
  • Use the command cleartool mkelem –master.
  • Use the command cleartool mkdir –master.
  • (Windows®; file elements only) In the Add to Source Control window, select Make current replica the master of all newly created branches.
For example, suppose your view has the following config spec:
element * CHECKEDOUT 
element * .../v1.0_bugfix/LATEST 
element * V1.0 -mkbranch v1.0_bugfix 
element * /main/0 -mkbranch v1.0_bugfix
Use the following procedure to assign mastership of new branches to your current replica:
  1. Create a new element with mkelem –master and check out the file:
    cleartool mkelem –master –nc cmdsyn.c
    Created element "cmdsyn.c" (type "text_file").
    Created branch "v1.0_bugfix" from "cmdsyn.c" version "/main/0".
    Note: Branch "v1.0_bugfix" explicitly mastered by replica "boston_hub".
          Branch type "v1.0_bugfix" mastered by replica "sanfran_hub".
    Checked out "cmdsyn.c" from version "/main/v1.0_bugfix/0".
    
  2. Use the describe command to confirm that the new branches are mastered by your current replica:
    
    cleartool describe cmdsyn.c@@/main cmdsyn.c@@/main/v1.0_bugfix
    branch "cmdsyn.c@@/main" 
      created 02-Sep-00.13:17:21 by Gail Smith (gail.user@boston30)
      branch type: main
      master replica: boston_hub@/vobs/dev
    ...
    branch "cmdsyn.c@@/main/v1.0_bugfix" 
      created 02-Sep-00.13:17:21 by Gail Smith (gail.user@boston30)
      branch type: v1.0_bugfix 
      master replica: boston_hub@/vobs/dev
    ...
    
If you make your current replica the master of newly created branches, but do not check out the file (that is, you use the –nco option), only the main branch is mastered by your current replica, because it is the only branch that is created. For example:
  1. Create a new element with mkelem –nco –master :
    cleartool mkelem –nco –master –c "syntax file" cmdsyn.c 
    Created element "cmdsyn.c" (type "text_file").
    
  2. Use the describe command to confirm that the main branch is mastered by your current replica:
    cleartool describe cmdsyn.c@@/main 
    branch "cmdsyn.c@@/main"
      created 02-Sep-00.13:21:21 by Gail Smith (gail.user@boston30)
      branch type: main
      master replica: boston_hub@/vobs/dev
    ...
    
  3. List the element’s history to confirm that no other branches except main were created:
    cleartool lshistory cmdsyn.c
    02-Sep.13:21   gail      create version "cmdsyn.c@@/main/0"
    02-Sep.13:21   gail      create branch "cmdsyn.c@@/main"
    02-Sep.13:21   gail      create file element "cmdsyn.c@@"