Using Labels

Labels can be used to mark important file revisions, such as the set of file revisions used to build a particular software release. You can use labels to specify groups of related file revisions when you get file revisions (sync), compare file revisions (diff), and integrate (merge, copy, and branch).

To use labels, you first define the label and then apply the label to file revisions in the depot.

Creating and editing labels

You must use P4V, the Perforce Visual Client, or p4, the Perforce Command-Line Client, to create and edit labels. For more information, see the P4V help or the P4 User Guide.

Labeling files

You must use P4V, the Perforce Visual Client, or p4, the Perforce Command-Line Client, to apply labels to files. For more information, see the P4V help or the P4 User Guide.

Displaying and searching for labels

To display the labels defined for the Perforce depot to which you are connected in P4VS:

  1. Go to View > Labels to open the Labels tool window.
  2. To search for labels, use the filter fields.

    You can filter by any combination of the following:

    • Owner
    • Label name
    • File path

      Use standard Perforce syntax (//depot/folder/folder/filename or //depot/folder/…​). For more information, see the P4 User Guide.

    To change the order in which columns are displayed, drag the column headings right or left to the desired position. To sort by column, click the sort arrow on a column heading.

  3. To view details about a label, such as the owner, description, and view, select the label row and click Details in the lower pane.
  4. To view a list of files in a label, select the label row and click Files in the lower pane.

Retrieving files by label

To retrieve a file revision in a label:

  1. Context-click the file in Solution Explorer and select Revisions > Get Revision…​.
  2. Select Specify revision using: Label and browse for the label.
  3. (Optional) Select Remove files from workspace if they are not in label to ensure that your workspace contains only the labeled file revisions.