Creating labels using the "label" command


The syntax for this command is:
stcmd{Ex} label -nl "labelName" [-vl "labelName" | -vd "asOfDate" | -vp stateName] [-d "description"] [-b | -r] [-f] [-u] [–pattern “datepattern”] [-ps promotionStateName ]  [–epwdfile “passwordfilepath”] [-p "userName:password@hostName:endpoint/projectName/[viewName/][folderHierarchy/]"] | [-s "userName:password@hostName:endpoint]

Use label to create or update a view or revision label. A view label can be designated as a build label. By default, view labels are automatically applied to every folder, file, change request, requirement, topic, and task in the view. By default, revision labels are not applied to any items.

You can use apply-label to apply labels created with label to specified files. You can also use the
label option (-vl) in ci to attach your new label to files as you check them in.

Parameter Description
-b Specifies that the new label is a build label. Without either-b or -r, the label is a view label.
View labels (and a build label is a special type of view label) are immediately and
automatically applied to every folder, file, change request, task, and topic in the view.

-d Specifies the description of the label.

-r Specifies that the new label is a revision label. You can use the new label to label files that
you check in. This command does not attach the new label to any items unless you create
the label by copying an existing revision label that is attached to one or more items. See the -
vl option.

-f Creates the new label as a frozen label or updates an existing label and marks it as a frozen

-u Creates the new label as an unlocked label or updates an existing frozen label and marks it

-nl Specifies the new label’s name. If not found, a new label will be created. If found, the existing
label description will be updated and the label will be marked frozen or unlocked.

-pattern Qualifies the datetime. It can be specified wherever a date-time is specified, such as -cfgd,
-vd, etc. The pattern must match any valid pattern supported by the java JDK in
java.text.SimpleDateFormat.applyLocalizedPattern(String). The pattern
may be localized.
For every command that takes a -pattern parameter, a -locale parameter is optionally
available. This is the "two character country code".

-pf Specifies the filter name whose associated filter properties produce the columns in the output
matrix. Each command returns a result matrix. -pf determines the matrix columns. See -
ofp for more information. If not specified, the primary descriptor property of the Type is
returned as the command output.

-vd Specifies the as-of date/time used to identify the revisions to be checked out. The last
revision before the specified date/time is the one checked out for each file. See the date/time
examples for -cfgd.
-vl Specifies a label (created using stcmd label) to be applied to the checked-in files. The
label is enclosed in double quotation marks. This option can appear in the command more
than once. The label can be either a view or revision label, but it must already exist in the
-vp Specifies the promotion state.

-ps When -ps is specified, the label is assigned to the promotion state specified by -vp. If the
label name does not exist, then a new label is created following existing rules. If the label
name already exists, then it is simply assigned to the promotion state.
Note: If none of -vd, -vl or -vp are specified, then the created label is based on the
current server time.

-p Indicates the view or folder to be used and also provides the user name and password needed to access the StarTeam Server. specifically, -p "user{:password}@host:port/projectName/viewName}

-epwdfile if a password is not specified in -p, then -epwdfile must be specified.

Unlike the 'CRUD' commands (select, insert, update and delete), -p and/or -epwdfile are not positional, and are not required to be at the end of the command. However, for consistency, application scripters may choose to position them so.

The following example uses label to create a new build label named Beta for the StarDraw view of the
StarDraw project.
Use the -p with label or the stateful set command to set the context of the project/view/parent folder.
stcmd label -nl "Beta" -b


How To-Best Practice
Comment List