Sync using an automatic label

Helix Core Server’s automatic label feature enables you to specify which repos you want to sync with which branches, tags, or commits. This enables you to sync to multiple repos, not all of which are at the same branch, tag, or commit.

This might be useful when you are building a Git project that is dependent on other projects that are at a particular release version, tag, or commit (SHA-1). In non-Helix Core Server Git solutions, the manifest file traditionally performs this function.

Note

To sync more narrowly than at the repo level, use the View field in the client (workspace) specification. See the topic p4 client in Helix Core Command-Line (P4) Reference.

To use automatic labels with Git repos, you edit the label specification (spec) by issuing the p4 label command. In particular, you edit two fields: Revision and View:

  • The Revision field must always be set to "#head" when using automatic labels with Git repo data.
  • The View field contents vary according to what you want to sync to.

With the following label spec settings, Helix Core Server syncs:

  • the collection of repos under depot //android to tag android-7.1.1_r23.
  • the collection of repos under //android/platform/build to branch master.
  • the repo //android/platform/build/kati to commit SHA-1 341a2ceccb836ab23f92c0ba96d0a0e73142576.
# A Perforce Label Specification.
#
#  Label:       release1_build
#  Update:      The date this specification was last modified.
#  Access:      The date of the last 'labelsync' on this label.
#  Owner:       bruno
#  Options:     Label update options: [un]locked, [no]autoreload.
#  Revision:    "#head"
#  View:        Lines to select depot files for the label.
#
# Use 'p4 help label' to see more about label views.

Label:  release1_build

Owner:  bruno

Description:
        Created by bruno.

Options:        unlocked noautoreload

Revision:    "#head"

#  View:        Lines to select depot files for the label.
View:
        //android/…@refs/tags/android-7.1.1_r23
        //android/platform/build/…@master
        //android/platform/build/kati/…@341a2ceccb836ab23f92c0ba96d0a0e73142576

For more information on automatic labels, see the chapter Labels in Helix Core Command-Line (P4) Guide.