Attach labels using the apply-label command


The syntax for this command is:
stcmd{Ex} apply-label [–epwdfile “passwordfilepath”] [-p "userName:password@hostName:endpoint/projectName/[viewName/][folderHierarchy/]"] | [-s "userName:password@hostName:endpoint] [-cmp] [-csf] [-encrypt encryptionType] ] [-is]
[-rp "folderPath" | -fp "folderPath"] [-ifp "file path"|-filter "fileStatus"] [-vl "labelName" | -vd "asOfDate"] [-pattern "date-pattern"] | -vn revisionNumber | -vp promotionStateName] -lbl "labelName" [-q|-pf "filterName"] [-pattern "date-pattern"] [-u] [-l] [-iip] [-ofp "resultsOutputpath"][-folder folderHierarchyPath [-scope FO|FC|FTC]] [files...]

Use apply-label to label specified file revisions with view or revision labels. The labels must already
exist in StarTeam. You can create the labels in StarTeam with the label command

Parameter Description
-filter Specifies a string of one or more characters, each of which represents a file status. Never
include spaces or other white space in this string. Only files that currently have the specified
status(es) will be actioned. Does not apply to files that are Not In View.
• C = Current
• M = Modified
• O = Out of date
• N = Not In View
• I = Missing
• G = Merge
• U = Unknown
For example, using CM applies a command only to files with a status of Current or

-ifp Specifies a fully qualified path to a file which contains a list of item IDs. The items associated
with item IDs are associated to the label. If -ifp is specified, -filter "fileStatus"
cannot be specified.

-iip Ignore invalid path. If specified, and if the -p folder path is invalid, then exit quietly and successfully without throwing an exception.

-l Locks the item(s). This is the default when -l, -nel or -u are not used.

-u Unlocks an item.

-lbl Specifies the label name on which to perform the action. This option can be used more than
once. The application action is for all of the labels on the specified file or revisions.

-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
-vn Specifies the revision number used to identify the revisions that get the new label.
-vp Specifies the promotion state.

-folder Specifies the folder/path on which to apply the label. This path must match a StarTeam
starting folder from the root folder down to the node folder and begin and end with a / or \. If
a folder path is specified, then the files argument is ignored.
-scope This argument must use one of the following:
• FO - folder only.
• FC - folder and contents.
• FTC - folder tree and contents.
If -scope is not specified, the default behavior for -folder is FTC.

-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, as long as the optional [files] (e.g. *.doc) come last.

The following example uses apply-label to apply the label Beta to the specified folder Edge:
apply-label –p “user:password@host:port/project/view” –lbl “Beta” –folder “/
Stargate/dev/src/Edge/’ –scope FO
The following example uses apply-label to apply the label Beta to files in User Manual, a child of the
root folder StarDraw (in the StarDraw view of the StarDraw project). StarTeam applies the label to the
revisions of those files that were current at noon on July 7, 2013.
Use -p with apply-label or the stateful set command to set the context of the project/view/parent
stcmd apply-label -rp "1024/StarDraw/StarDraw/User Manual" -vd "07/07/13
12:00 PM" -lbl "Beta" -u -l "*"


How To-Best Practice
Comment List