p4 label
Create or edit a label specification and its view.
Syntax
p4 [g-opts] label [-f -g] [-t template] labelname
p4 [g-opts] label -d [-f -g] labelname
p4 [g-opts] label -o [-t template] labelname
p4 [g-opts] label -i [-f -g]
Description
Use p4 label to create a new label specification or
      edit an existing label specification. A labelname is
      required.
Running p4 label allows you to configure the mapping
      that controls the set of files that are allowed to be included in the
      label. After configuring the label, use p4 labelsync or p4 tag to tag files with the
      label.
Labels can be either automatic or static. Automatic labels refer to the
      revisions provided in the View and Revision fields. Static labels refer only to those specific revisions tagged by
      the label by the p4
	    labelsync or p4
	    tag commands.
Only the Owner of an unlocked label can use
      p4 labelsync or p4 tag to tag files with that
      label. The owner of a group can be a single user or a group.
A branch, depot, label, and workspace cannot share the same name.
Automatic labels
Automatic labels refer to the revisions provided in the
      View and Revision fields of the label
      specification. To create an automatic label, fill in the
      Revision field of the p4 label spec
      with a revision specifier. When you sync a workspace to an automatic
      label, the contents of the Revision field are applied to
      every file in the View field. 
Example: Using an automatic label as an alias for a changelist number
Bruno is running a nightly build process, and has successfully built a
	product as of changelist 1234. Rather than having to remember the
	specific changelist for every night’s build, he types p4 label
	    nightly20111201 and uses the label’s
	Revision field to automatically tag all files as of
	changelist 1234 with the nightly20111201 label:
Label:    nightly20111201
Owner:    bruno
Description:
    Nightly build process.
Options:    unlocked noautoreload
View:
    //depot/...
Revision:
    @1234Advantage to this approach: facilitates scripting, does not use much space in label table, and provides a way to refer to a nightly build without remembering which changelist number was associated with the night’s build process.
Example: Referring specifically to the set of files submitted in a single changelist
A bug was fixed by means of changelist 1238, and requires a patch
	label that refers to only those files associated with the fix. Bruno
	types p4 label patch20111201 and uses the label’s
	Revision field to automatically tag only those files
	submitted in changelist 1238 with the patch20111201
	label:
Label:    patch20111201
Owner:    bruno
Description:
    Patch to 2011/12/01 nightly build.
Options:    unlocked noautoreload
View:
    ## comment line
    //depot/...  ## comment appended
Revision:
    @1238,1238This automatic label refers only to those files submitted in changelist 1238.
Example: Referring to the first revision of every file over multiple changelists
You can use revision specifiers other than changelist specifiers. In
	this example, Bruno specifies to the first revision (#1) of every
	file in a branch. Depending on how the branch was populated, these
	files could have been created through multiple changelists over a long
	period of time:
Label:  first2.2
Owner:  bruno
Description:
    The first revision in the 2.2 branch
Options:    unlocked noautoreload
View:
    //JamCode/release/jam/2.2/src/...
Revision:
    "#1"Because
	P4 Server
	forms use the # character as a comment indicator, Bruno
	has placed quotation marks around the # to ensure that it
	is parsed as a revision specifier.
Form Fields
| Field Name | Type | Description | 
|---|---|---|
| 
 | Read-only | The label name as provided in the invoking command. Be aware of the Limitations on characters in filenames and entities. | 
| 
 | Writable, optional | By default, the owner is the user who created the label. The specified owner does not have to be a P4 Server user. You might want to use an arbitrary name if the owner does not yet exist, or if you have deleted the owner and need a placeholder until you can assign the spec to a new owner. | 
| 
 | Read-only | The date the label specification was last modified. | 
| 
 | Read-only | The date and time the label was last accessed, either by running
	       | 
| 
 | Writable, optional | An optional description of the label’s purpose. | 
| 
 | Writable | Options to control behavior and storage location of labels 
 | 
| 
 | Writable | An optional revision specification for an automatic label. If you use the  | 
| 
 | Writable | A list of depot files that can be tagged with this label. No
	      files are actually tagged until  Unlike client views or branch views, which map one set of files to another, label views consist of a simple list of depot files. To learn more, see the topic that explains Views. Comments are preceded by  
View:
        ## comment line
        //depot/...  ## comment appended | 
| 
 | Writable, optional | If set, restricts usage of the label to the named server. If unset, this label can be used on any server. | 
Options
| 
 | Delete the named label if it’s  | 
| 
 | Allow the  | 
| 
 | In multi-server environments, use the  Global labels can be updated from edge servers using either p4 tag -g or p4 labelsync -g | 
| 
 | Read the label definition from standard input without invoking the editor. | 
| 
 | Write the label definition to standard output without invoking the editor. | 
| 
 | Copy label  | 
| 
 | See Global options. | 
Usage notes
| Can File Arguments Use Revision Specifier? | Can File Arguments Use Revision Range? | Minimal Access Level Required | 
|---|---|---|
| N/A | N/A | 
 | 
- To create an automatic label, fill in the Revisionfield of thep4 labelform with a revision specifier. When you sync a workspace to an automatic label, the contents of theRevisionfield are applied to every file in theViewfield.
- 
                                                    Local Label Global Label rpl.labels.globalis unset, which is 0rpl.labels.globalset to 1by default, labels are local to your edge server by default, labels are global -goption provides access to global labels on the commit server-goption allows the updating of local labelsIf a label exists on an edge server before rpl.labels.global is set, and you want that label to be available on both the edge server and the commit server, unloaded the label from the edge server and reload it on the commit server 
Examples
| 
 | List the file revisions tagged by
	       | 
Related commands
| To synchronize a label with the client workspace. | |
| To list all labels known to the system | |
| To create a label and tag files with the label |