Use 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.

Create and edit labels

To create and edit labels, use P4V or p4, the P4 Server command-line client. See P4 Visual Client (P4V) Documentation or P4 CLI Documentation.

Label files

To apply labels to files, use P4V or p4, the P4 Server command-line client. See P4 Visual Client (P4V) Documentation or P4 CLI Documentation.

Display and search for labels

To display the labels defined for the P4 Server depot to which you are connected in P4 for Visual Studio:

  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 P4 Server syntax (//depot/folder/folder/filename or //depot/folder/…​). To learn more, see the P4 CLI Documentation.

    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.

Retrieve files by label

To retrieve a file revision in a label:

  1. Right-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.