Tag depot files with the passed-in label.
Namespace: Perforce.P4Assembly: p4api.net (in p4api.net.dll) Version: 2017.3.160.836 (2017.3.160.0836)
Syntax
C# |
---|
public IList<FileSpec> TagFiles( IList<FileSpec> filespecs, string labelid, Options options ) |
Visual Basic |
---|
Public Function TagFiles ( _ filespecs As IList(Of FileSpec), _ labelid As String, _ options As Options _ ) As IList(Of FileSpec) |
Visual C++ |
---|
public: IList<FileSpec^>^ TagFiles( IList<FileSpec^>^ filespecs, String^ labelid, Options^ options ) |
Parameters
- filespecs
- Type: System.Collections.Generic..::..IList<(Of <(<'FileSpec>)>)>
- labelid
- Type: System..::..String
- options
- Type: Perforce.P4..::..Options
Return Value
Remarks
p4 help tag
tag -- Tag files with a label
p4 tag [-d -g -n -U] -l label file[revRange] ...
Tag associates the named label with the file revisions specified by
the file argument. After file revisions are tagged with a label,
revision specifications of the form '@label' can be used to refer
to them.
If the file argument does not include a revision specification, the
head revisions is tagged. See 'p4 help revisions' for revision
specification options.
If the file argument includes a revision range specification, only
the files with revisions in that range are tagged. Files with more
than one revision in the range are tagged at the highest revision.
The -d deletes the association between the specified files and the
label, regardless of revision.
The -n flag previews the results of the operation.
Tag can be used with an existing label (see 'p4 help labels') or
with a new one. An existing label can be used only by its owner,
and only if it is unlocked. (See 'p4 help label').
The -U flag specifies that the new label should be created with the
'autoreload' option (See 'p4 help label'). It has no effect on an
existing label.
To list the file revisions tagged with a label, use 'p4 files
@label'.
The -g flag is used on an Edge Server to update a global label.
Configuring rpl.labels.global=1 reverses this default and causes this
flag to have the opposite meaning.
Examples
To tag the file //depot/MyCode/README.txt with build_label:
CopyC#
To remove the association between the file //depot/MyCode/README.txt
and build_label:
CopyC#
To get a preview list of the files that would be tagged in path
//depot/main/src with build_label:
CopyC#
![](../icons/CopyCode.gif)
TagCmdOptions opts = new TagCmdOptions(TagFilesCmdFlags.None, null); FileSpec filespec = new FileSpec(new DepotPath("//depot/MyCode/README.txt"), null); IList<FileSpec> filespecs = new List<FileSpec>(); filespecs.Add(filespec); IList<FileSpec> target = Repository.TagFiles(filespecs, "build_label", opts);
![](../icons/CopyCode.gif)
TagCmdOptions opts = new TagCmdOptions(TagFilesCmdFlags.Delete, null); FileSpec filespec = new FileSpec(new DepotPath("//depot/MyCode/README.txt"), null); IList<FileSpec> filespecs = new List<FileSpec>(); filespecs.Add(filespec); IList<FileSpec> target = Repository.TagFiles(filespecs, "build_label", opts);
![](../icons/CopyCode.gif)
TagCmdOptions opts = new TagCmdOptions(TagFilesCmdFlags.ListOnly, null); FileSpec filespec = new FileSpec(new DepotPath("//depot/main/src/..."), null); IList<FileSpec> filespecs = new List<FileSpec>(); filespecs.Add(filespec); IList<FileSpec> target = Repository.TagFiles(filespecs, "build_label", opts);