p4 labelsync

Synchronize a label with the contents of the current client workspace.

Syntax

p4 [g-opts] labelsync [-a -d -g -n -q] -l labelname [[FileSpec][revSpec]]

Syntax conventions

Description

p4 labelsync causes the named label to reflect the current contents of the client workspace by tagging the last revision of each file synced into the workspace with the label name. The label name can subsequently be used in a revision specification as @label to refer to the revision of the file that was tagged with the label.

Without a file argument, p4 labelsync causes the label to reflect the contents of the client workspace by adding, deleting, and updating the set of files tagged with the label.

  • If a file is given, p4 labelsync updates the tag for only that named file.
  • If the file argument includes a revision specification, the client view is ignored. The specified revision is used instead of the revision existing in the workspace.
  • If the file argument includes a revision range, only the highest revision in that range is used.

Only the Owner: of an unlocked label can use p4 labelsync to tag files with that label.

A label that has its Options: field set to locked cannot be updated with p4 labelsync.

Options

-a

Add the label to files that match the file pattern arguments; no files are deleted from the label.

-d

Delete the label tag from the named files.

-g

In multi-server environments, use the -g option to specify whether the label being applied is local to an edge server, or is globally available from the commit server.

Note

Global labels can be updated from edge servers using either p4 tag -g or p4 labelsync -g

-l labelname

Specify the label to be applied to file revisions.

-n

Display what p4 labelsync would do without actually performing the operation.

-q

Quiet operation: suppress normal output messages. Messages regarding errors or exceptional conditions are not suppressed.

g-opts

See Global options.

Usage Notes

Can File Arguments Use Revision Specifier? Can File Arguments Use Revision Range? Minimal Access Level Required

Yes

Yes

open

  • By default, p4 labelsync operates on the revisions of files last synced to your client workspace. To tag the head revisions of files (or the highest revision in a specified range), use p4 tag.
  • To see which files are tagged by the label, use p4 files @labelname.
  • With a multi-server Perforce service, p4 labelsync works with a label local to the edge server (to which you are sending a request). The -g option can be used to apply a global label, but only with an unbound (global) client workspace.

    By default, labels are local to your edge server, and you use the -g option to access global labels on the commit server. If your administrator has set rpc.labels.global to 1, labels are global by default, and the meaning of the -g option is inverted to allow updating of local labels.

Related Commands

To create or edit a label

p4 label

To list all labels known to the system

p4 labels

To create a label and tag files with the label

p4 tag