mkbranch

Creates a new branch in the version tree of an element

Applicability

Product

Command type

VersionVault

cleartool subcommand

VersionVault Remote Client

rcleartool subcommand

Platform

UNIX®

Linux®

Windows®

Synopsis

  • VersionVault:
    mkbranch [ –c/omment comment | –cfi/le comment-file-pname |–cq/uery
    | –cqe/ach | –nc/omment ] [ –nwa/rn ]

    [ –nco ] [ –ptime ] [ –ver/sion version-selector ] branch-type-selector pname ...

  • VersionVault Remote Client:
    mkbranch [ –c/omment comment | –nc/omment | –cq/uery | –cqe/ach ]
    [ –nwa/rn ] [ –nco ] [ –ptime ]

    [ –ver/sion version-selector ] branch-type-selector pname ...

Description

The mkbranch command creates a new branch in the version trees of one or more elements. The new branch is checked out, unless you use the –nco option.

Auto-make-branch

The checkout command sometimes invokes mkbranch automatically. If the view's version of an element is selected by a config spec rule with a –mkbranch branch-type clause, checkout does the following:

  1. Creates a branch of type branch-type.
  2. Checks out (version 0 on) the newly created branch.

Explicit branch mastership

In the case of a replicated VOB, you can assign explicit mastership of a new branch by either of these methods:
  • Use a mastership transfer command: chmaster or reqmaster.
  • Ensure that the replica feature level is 9 or greater and that request for mastership is enabled (reqmaster -enable).

Restrictions

Identities

You must have one of the following identities:

  • Element group member
  • Element owner
  • VOB owner
  • root (UNIX® and Linux®)
  • Member of the VersionVault administrators group (VersionVault on Windows®)

Locks

An error occurs if one or more of these objects are locked: VOB, element type, branch type, element, pool (nondirectory elements).

Mastership

(Replicated VOBs) Your current replica must master the branch type.

Options and arguments

Event records and comments

Default
Creates one or more event records, with commenting controlled by your .versionvault_profile file (default: –cqe). See the comments reference page. Comments can be edited with chevent.
–c/omment comment | –cfi/le comment-file-pname |–cq/uery | –cqe/ach | –nc/omment
Overrides the default with the option you specify. See the comments reference page.

Suppressing warning messages

Default
Warning messages are displayed.
–nwa/rn
Suppresses warning messages.

Checkout of the new branch

Default
The newly created branch is checked out. Additional checkouts may ensue; see the section Auto-make-branch.
–nco
Suppresses automatic checkout of the branch. This option is required for VersionVault Remote Client.

Preserving modification time

Default
For the initial version on a new branch, mkbranch sets the modification time to the branch creation time.
–pti/me
For the initial version on a new branch, preserves the modification time of its predecessor version.

Specifying the branch type

Default
None.
branch-type-selector
An existing branch type, previously created with mkbrtype. The branch type must exist in each VOB in which you are creating a branch, or (if branch-type-selector is a global type) in the administrative VOB hierarchy associated with each VOB. Specify branch-type-selector in the form [brtype:]type-name[@vob-selector]

Specifying the branch type

type-name

Name of the branch type

vob-selector

VOB specifier

pname-in-vob

Path name of the VOB tag (whether or not the VOB is mounted) or of any file system object within the VOB (if the VOB is mounted)

Specifying the branch points

Default
None.
–ver/sion version-selector
For each pname, creates the branch at the version specified by version-selector. This option overrides both version-selection by the view and version-extended naming. See the version_selector reference page for syntax details.
pname ...
One or more path names, indicating the versions at which branches are to be created.
  • A standard or view-extended path name to an element specifies the version in the view.
  • A version-extended path name specifies a version, independent of view.

Use –version to override these interpretations of pname.

Examples

The UNIX system and Linux examples in this section are written for use in csh. If you use another shell, you may need to use different quoting and escaping conventions.

The Windows examples that include wildcards or quoting are written for use in cleartool interactive mode. If you use cleartool single-command mode, you may need to change the wildcards and quoting to make your command interpreter process the command appropriately.

In cleartool single-command mode, cmd-context represents the UNIX system and Linux shells or Windows command interpreter prompt, followed by the cleartool command. In cleartool interactive mode, cmd-context represents the interactive cleartool prompt.

  • On a UNIX® or Linux® system, create a branch type named bugfix. Then, set a view with a config spec that prefers versions on the bugfix branch, and create a branch of that type in file util.h.

    cmd-context mkbrtype –c "bugfixing branch" bugfix
    Created branch type "bugfix".
    cmd-context setview smg_bugfix
    cmd-context mkbranch –nc bugfix util.h
    Created branch "bugfix" from "util.h" version "/main/1".
    Checked out "util.h" from version "/main/bugfix/0".

  • On a Windows® system, create a branch type named bugfix. Then, set a view drive with a config spec that prefers versions on the bugfix branch, and create a branch of that type in file util.h.

    cmd-context mkbrtype –c "bugfixing branch" bugfix
    Created branch type "bugfix".
    > net use y: \\view\smg_bugfix
    ...
    > y:
    cmd-context mkbranch –nc bugfix util.h
    Created branch "bugfix" from "util.h" version "\main\1".
    Checked out "util.h" from version "\main\bugfix\0".

  • Create a branch named rel2_bugfix off the version of hello.c in the view, and check out the initial version on the branch.

    cmd-context mkbranch –nc rel2_bugfix hello.c
    Created branch "rel2_bugfix" from "hello.c" version "/main/4".
    Checked out "hello.c" from version "/main/rel2_bugfix/0".

  • Create a branch named maintenance off version \main\1 of file util.c. Do not check out the initial version on the branch.

    cmd-context mkbranch –version \main\1 –nco –nc maintenance util.c
    Created branch "maintenance" from "util.c" version "\main\1".

  • Create a branch named bugfix off version /main/3 of file hello.c, and check out the initial version on the branch. Use a version-extended pathname to specify the version.

    cmd-context mkbranch –nc bugfix hello.c@@/main/3
    Created branch "bugfix" from "hello.c" version "/main/3".
    Checked out "hello.c" from version "/main/bugfix/0".

  • For each file with a .c extension, create a branch named patch2 at the currently selected version, but do not check out the initial version on the new branch. Provide a comment on the command line.

    cmd-context mkbranch –nco –c "release 2 code patches" patch2 *.c
    Created branch "patch2" from "cm_add.c" version "\main\1".
    Created branch "patch2" from "cm_fill.c" version "\main\3".
    Created branch "patch2" from "msg.c" version "\main\2".
    Created branch "patch2" from "util.c" version "\main\1".