[This is preliminary documentation and is subject to change.]

Create a new label in the repository.

Namespace: Perforce.P4
Assembly: p4api.net (in p4api.net.dll) Version: 2012.2.63.1250 (2012.2.63.1250)

Syntax

C#
public Label CreateLabel(
	Label label,
	Options options
)
Visual Basic
Public Function CreateLabel ( _
	label As Label, _
	options As Options _
) As Label
Visual C++
public:
Label^ CreateLabel(
	Label^ label, 
	Options^ options
)

Parameters

label
Type: Perforce.P4..::..Label
Label specification for the new label
options
Type: Perforce.P4..::..Options
The '-i' flag is required when creating a new label

Return Value

The Label object if new label was created, null if creation failed

Remarks

The '-i' flag is added if not specified by the caller

p4 help label

label -- Create or edit a label specification

p4 label [-f -t template] name
p4 label -d [-f] name
p4 label -o [-t template] name
p4 label -i [-f]

Create or edit a label. The name parameter is required. The
specification form is put into a temporary file and the editor
(configured by the environment variable $P4EDITOR) is invoked.

The label specification form contains the following fields:

Label: The label name (read only.)

Owner: The user who created this label. Can be changed.

Update: The date that this specification was last modified.

Access: The date of the last 'labelsync' or use of '@label'
referencing this label.

Description: A short description of the label (optional).

Options: Flags to change the label behavior.

locked Prevents users other than the label owner
from changing the specification. Prevents
the label from being deleted. Prohibits
'p4 labelsync'.

Revision: An optional revision specification for an automatic
label. Enclose in double quotes if it contains the
# (form comment) character.

View: A mapping that selects files from the depot. The
default view selects all depot files. Only the left
side of the mapping is used for labels.

A label is a named collection of revisions. A label is either
automatic or static. An automatic label refers to the revisions
given in the View: and Revision: fields. A static label refers to
the revisions that are associated with the label using the 'p4 tag'
or 'p4 labelsync' commands. A static label cannot have a Revison:
field. See 'p4 help revisions' for information on using labels as
revision specifiers.

Flag -d deletes the specified label. You cannot delete a locked label.
The -f flag forces the delete.

The -o flag writes the label specification to standard output. The
user's editor is not invoked.

The -i flag reads a label specification from standard input. The
user's editor is not invoked.

The -t flag copies the view and options from the template label to
the new label.

The -f flag forces the deletion of a label. By default, locked labels
can only be deleted by their owner. The -f flag also permits the
Last Modified date to be set. The -f flag requires 'admin' access,
which is granted by 'p4 protect'.

See Also